diff options
author | Nokis Mavrogiannopoulos | 2008-09-14 16:40:15 +0000 |
---|---|---|
committer | Nokis Mavrogiannopoulos | 2008-09-14 16:40:15 +0000 |
commit | 1bbb7089c3f2190a206cc981235287333cca44f5 (patch) | |
tree | 0386ffba1a49138cdf59d507e9b3e6875c6bb4d2 /src | |
parent | c5abf98e068d3b7fb6081a9491c5384fa3ac69db (diff) |
use memmove instead of memcpy because buffers might overlap.
Diffstat (limited to 'src')
-rw-r--r-- | src/gnutls_io.c | 4 |
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; |