You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2010/08/10 21:08:27 UTC
svn commit: r984169 - in /httpd/httpd/branches/2.2.x: STATUS
modules/ssl/ssl_engine_io.c
Author: jim
Date: Tue Aug 10 19:08:27 2010
New Revision: 984169
URL: http://svn.apache.org/viewvc?rev=984169&view=rev
Log:
Merge r683280 from trunk:
* modules/ssl/ssl_engine_io.c (char_buffer_read): Use memmove in place
of memcpy since the buffers can overlap; add explanatory comment.
PR: 45444
Submitted by: jorton
Reviewed/backported by: jim
Modified:
httpd/httpd/branches/2.2.x/STATUS
httpd/httpd/branches/2.2.x/modules/ssl/ssl_engine_io.c
Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=984169&r1=984168&r2=984169&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Tue Aug 10 19:08:27 2010
@@ -87,12 +87,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * mod_ssl: use memmove instead of memcpy for overlapping buffers
- PR 45444
- Trunk patch: http://svn.apache.org/viewvc?view=revision&revision=683280
- 2.2 patch: trunk patch works with offset
- +1: sf, rpluem, trawick, jim
-
* core: (re)-introduce -T commandline option to suppress documentroot
check at startup
PR 41887
Modified: httpd/httpd/branches/2.2.x/modules/ssl/ssl_engine_io.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/ssl/ssl_engine_io.c?rev=984169&r1=984168&r2=984169&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/ssl/ssl_engine_io.c (original)
+++ httpd/httpd/branches/2.2.x/modules/ssl/ssl_engine_io.c Tue Aug 10 19:08:27 2010
@@ -344,6 +344,13 @@ typedef struct {
* this char_buffer api might seem silly, but we don't need to copy
* any of this data and we need to remember the length.
*/
+
+/* Copy up to INL bytes from the char_buffer BUFFER into IN. Note
+ * that due to the strange way this API is designed/used, the
+ * char_buffer object is used to cache a segment of inctx->buffer, and
+ * then this function called to copy (part of) that segment to the
+ * beginning of inctx->buffer. So the segments to copy cannot be
+ * presumed to be non-overlapping, and memmove must be used. */
static int char_buffer_read(char_buffer_t *buffer, char *in, int inl)
{
if (!buffer->length) {
@@ -352,13 +359,13 @@ static int char_buffer_read(char_buffer_
if (buffer->length > inl) {
/* we have have enough to fill the caller's buffer */
- memcpy(in, buffer->value, inl);
+ memmove(in, buffer->value, inl);
buffer->value += inl;
buffer->length -= inl;
}
else {
/* swallow remainder of the buffer */
- memcpy(in, buffer->value, buffer->length);
+ memmove(in, buffer->value, buffer->length);
inl = buffer->length;
buffer->value = NULL;
buffer->length = 0;