Use memmove rather than memcpy here, since the source and destination will
authorDan Winship <danw@src.gnome.org>
Tue, 3 Feb 2004 17:16:54 +0000 (17:16 +0000)
committerDan Winship <danw@src.gnome.org>
Tue, 3 Feb 2004 17:16:54 +0000 (17:16 +0000)
        * libsoup/soup-socket.c (read_from_buf): Use memmove rather than
        memcpy here, since the source and destination will overlap if
        *nread is small and read_buf->len is large. (Noticed by valgrind,
        #53625.)

ChangeLog
libsoup/soup-socket.c

index 143f706..494a326 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-02-03  Dan Winship  <danw@ximian.com>
+
+       * libsoup/soup-socket.c (read_from_buf): Use memmove rather than
+       memcpy here, since the source and destination will overlap if
+       *nread is small and read_buf->len is large. (Noticed by valgrind,
+       #53625.)
+
 2004-02-02  Joe Shaw  <joe@ximian.com>
 
        * libsoup/soup-gnutls.c (soup_gnutls_close): Call gnutls_bye()
index 011e20d..ed7afbf 100644 (file)
@@ -878,8 +878,8 @@ read_from_buf (SoupSocket *sock, gpointer buffer, gsize len, gsize *nread)
                g_byte_array_free (read_buf, TRUE);
                sock->priv->read_buf = NULL;
        } else {
-               memcpy (read_buf->data, read_buf->data + *nread, 
-                       read_buf->len - *nread);
+               memmove (read_buf->data, read_buf->data + *nread, 
+                        read_buf->len - *nread);
                g_byte_array_set_size (read_buf, read_buf->len - *nread);
        }