summaryrefslogtreecommitdiffstats
path: root/crypto/buffer
diff options
context:
space:
mode:
authorBen Laurie <ben@links.org>2016-05-04 12:45:49 +0200
committerBen Laurie <ben@links.org>2016-05-07 19:28:07 +0200
commit5cf14ce074dfd1780ae4c68b2e7f083bfaf47530 (patch)
tree28f4732f46bb1d29712fda9008aa58d9ca0309d8 /crypto/buffer
parentAdd fuzzing! (diff)
downloadopenssl-5cf14ce074dfd1780ae4c68b2e7f083bfaf47530.tar.xz
openssl-5cf14ce074dfd1780ae4c68b2e7f083bfaf47530.zip
memset() doesn't take NULL.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Diffstat (limited to 'crypto/buffer')
-rw-r--r--crypto/buffer/buffer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/buffer/buffer.c b/crypto/buffer/buffer.c
index a16f3bd342..1c76d662a6 100644
--- a/crypto/buffer/buffer.c
+++ b/crypto/buffer/buffer.c
@@ -128,7 +128,8 @@ size_t BUF_MEM_grow(BUF_MEM *str, size_t len)
return (len);
}
if (str->max >= len) {
- memset(&str->data[str->length], 0, len - str->length);
+ if (str->data != NULL)
+ memset(&str->data[str->length], 0, len - str->length);
str->length = len;
return (len);
}
@@ -160,7 +161,8 @@ size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
size_t n;
if (str->length >= len) {
- memset(&str->data[len], 0, str->length - len);
+ if (str->data != NULL)
+ memset(&str->data[len], 0, str->length - len);
str->length = len;
return (len);
}