From: Pekka Riikonen Date: Wed, 14 Mar 2001 21:15:49 +0000 (+0000) Subject: updates. X-Git-Tag: 1.2.beta1~2454 X-Git-Url: http://git.silcnet.org/gitweb/?p=crypto.git;a=commitdiff_plain;h=b9d9b5f2a2043436e3d12dff8eb0cdeaecd87719 updates. --- diff --git a/CHANGES b/CHANGES index 9333281e..aead67d5 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,10 @@ Wed Mar 14 20:37:35 EET 2001 Pekka Riikonen server code. Various commands now includes the CF_LAG_STRICT flag to disallow any kind of miss-use of the command. + * Fixed the silc_buffer_unformat to not to allocate any data + if the length of the data is zero. It used to allocate the + length + 1. Affected file lib/silcutil/silcbuffmt.c. + Wed Mar 14 16:10:30 EET 2001 Pekka Riikonen * Changed the format of AdminConnection configuration section diff --git a/lib/silcutil/silcbuffmt.c b/lib/silcutil/silcbuffmt.c index ae5a27ae..08c8e290 100644 --- a/lib/silcutil/silcbuffmt.c +++ b/lib/silcutil/silcbuffmt.c @@ -250,7 +250,7 @@ int silc_buffer_unformat(SilcBuffer src, ...) SILC_GET16_MSB(len2, src->data); silc_buffer_pull(src, 2); HAS_SPACE(src, len2); - if (x) { + if (x && len2) { *x = silc_calloc(len2 + 1, sizeof(unsigned char)); memcpy(*x, src->data, len2); } @@ -278,7 +278,7 @@ int silc_buffer_unformat(SilcBuffer src, ...) SILC_GET32_MSB(len2, src->data); silc_buffer_pull(src, 4); HAS_SPACE(src, len2); - if (x) { + if (x && len2) { *x = silc_calloc(len2 + 1, sizeof(unsigned char)); memcpy(*x, src->data, len2); } @@ -312,7 +312,7 @@ int silc_buffer_unformat(SilcBuffer src, ...) HAS_SPACE(src, len2); if (len) *len = len2; - if (x) { + if (x && len2) { *x = silc_calloc(len2 + 1, sizeof(unsigned char)); memcpy(*x, src->data, len2); }