aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikos Mavrogiannopoulos 2008-09-14 16:40:15 +0000
committerGravatar Nokis Mavrogiannopoulos 2008-09-14 16:40:15 +0000
commit4fb2b3c3aa8f7584a12eefce1b86f76a5f035152 (patch)
tree0386ffba1a49138cdf59d507e9b3e6875c6bb4d2
parent5021874d73bffee4456676d4b709721032fd1724 (diff)
use memmove instead of memcpy because buffers might overlap.
-rw-r--r--src/gnutls_io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gnutls_io.c b/src/gnutls_io.c
index 753c87b..1505666 100644
--- a/src/gnutls_io.c
+++ b/src/gnutls_io.c
@@ -72,13 +72,13 @@ static int char_buffer_read(mgs_char_buffer_t * buffer, char *in,
72 72
73 if (buffer->length > inl) { 73 if (buffer->length > inl) {
74 /* we have have enough to fill the caller's buffer */ 74 /* we have have enough to fill the caller's buffer */
75 memcpy(in, buffer->value, inl); 75 memmove(in, buffer->value, inl);
76 buffer->value += inl; 76 buffer->value += inl;
77 buffer->length -= inl; 77 buffer->length -= inl;
78 } 78 }
79 else { 79 else {
80 /* swallow remainder of the buffer */ 80 /* swallow remainder of the buffer */
81 memcpy(in, buffer->value, buffer->length); 81 memmove(in, buffer->value, buffer->length);
82 inl = buffer->length; 82 inl = buffer->length;
83 buffer->value = NULL; 83 buffer->value = NULL;
84 buffer->length = 0; 84 buffer->length = 0;