From: Dan Winship Date: Tue, 3 Feb 2004 17:16:54 +0000 (+0000) Subject: Use memmove rather than memcpy here, since the source and destination will X-Git-Tag: LIBSOUP_2_1_6~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c2e77163480a21059dfeef06602363df29dfc91;p=platform%2Fupstream%2Flibsoup.git Use memmove rather than memcpy here, since the source and destination will * 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.) --- diff --git a/ChangeLog b/ChangeLog index 143f706..494a326 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-02-03 Dan Winship + + * 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 * libsoup/soup-gnutls.c (soup_gnutls_close): Call gnutls_bye() diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c index 011e20d..ed7afbf 100644 --- a/libsoup/soup-socket.c +++ b/libsoup/soup-socket.c @@ -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); }