summaryrefslogtreecommitdiff
path: root/lib/gnutls_buffers.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2002-01-26 23:01:52 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2002-01-26 23:01:52 +0000
commit36d88b8cb6dea5f3aa11ba5c3f4ccc64d64b36ba (patch)
treeb2f6b840c3c1195b631b01ce9f93ede4112bd197 /lib/gnutls_buffers.c
parentc9c1d23b48fdd5cec55753937ddfc1307fb4be13 (diff)
downloadgnutls-36d88b8cb6dea5f3aa11ba5c3f4ccc64d64b36ba.tar.gz
Added stuff for DSS certificates (not ready yet)
Diffstat (limited to 'lib/gnutls_buffers.c')
-rw-r--r--lib/gnutls_buffers.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c
index c821a1ba02..aec196d0a2 100644
--- a/lib/gnutls_buffers.c
+++ b/lib/gnutls_buffers.c
@@ -160,7 +160,7 @@ int _gnutls_record_buffer_get(ContentType type, GNUTLS_STATE state, char *data,
memcpy(data, state->gnutls_internals.application_data_buffer.data, length);
/* overwrite buffer */
- memcpy(state->gnutls_internals.application_data_buffer.data,
+ memmove(state->gnutls_internals.application_data_buffer.data,
&state->gnutls_internals.application_data_buffer.data[length],
state->gnutls_internals.application_data_buffer.size);
state->gnutls_internals.application_data_buffer.data =
@@ -179,7 +179,7 @@ int _gnutls_record_buffer_get(ContentType type, GNUTLS_STATE state, char *data,
memcpy(data, state->gnutls_internals.handshake_data_buffer.data, length);
/* overwrite buffer */
- memcpy(state->gnutls_internals.handshake_data_buffer.data,
+ memmove(state->gnutls_internals.handshake_data_buffer.data,
&state->gnutls_internals.handshake_data_buffer.data[length],
state->gnutls_internals.handshake_data_buffer.size);
state->gnutls_internals.handshake_data_buffer.data =
@@ -902,18 +902,22 @@ int _gnutls_handshake_buffer_get( GNUTLS_STATE state, char *data, int length)
state->gnutls_internals.handshake_hash_buffer.size -= length;
memcpy(data, state->gnutls_internals.handshake_hash_buffer.data, length);
/* overwrite buffer */
- memcpy(state->gnutls_internals.handshake_hash_buffer.data,
- &state->gnutls_internals.handshake_hash_buffer.data[length],
- state->gnutls_internals.handshake_hash_buffer.size);
- state->gnutls_internals.handshake_hash_buffer.data =
- gnutls_realloc_fast(state->gnutls_internals.handshake_hash_buffer.data,
- state->gnutls_internals.handshake_hash_buffer.size);
+
+ if (state->gnutls_internals.handshake_hash_buffer.size > 0) {
+ memmove(state->gnutls_internals.handshake_hash_buffer.data,
+ &state->gnutls_internals.handshake_hash_buffer.data[length],
+ state->gnutls_internals.handshake_hash_buffer.size);
- if (state->gnutls_internals.handshake_hash_buffer.data == NULL) {
- gnutls_assert();
- return GNUTLS_E_MEMORY_ERROR;
- }
+ state->gnutls_internals.handshake_hash_buffer.data =
+ gnutls_realloc_fast(state->gnutls_internals.handshake_hash_buffer.data,
+ state->gnutls_internals.handshake_hash_buffer.size);
+ if (state->gnutls_internals.handshake_hash_buffer.data == NULL) {
+ gnutls_assert();
+ return GNUTLS_E_MEMORY_ERROR;
+ }
+ }
+
return length;
}