From 9c2e77163480a21059dfeef06602363df29dfc91 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 3 Feb 2004 17:16:54 +0000 Subject: [PATCH] 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.) --- ChangeLog | 7 +++++++ libsoup/soup-socket.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) 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); } -- 2.7.4