summaryrefslogtreecommitdiffstats
path: root/crypto/buffer
diff options
context:
space:
mode:
authorBen Laurie <ben@links.org>2016-05-04 11:45:49 +0100
committerBen Laurie <ben@links.org>2016-05-07 18:28:07 +0100
commit5cf14ce074dfd1780ae4c68b2e7f083bfaf47530 (patch)
tree28f4732f46bb1d29712fda9008aa58d9ca0309d8 /crypto/buffer
parentc38bb72797916f2a0ab9906aad29162ca8d53546 (diff)
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);
}