memset() doesn't take NULL.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
This commit is contained in:
Ben Laurie 2016-05-04 11:45:49 +01:00
parent c38bb72797
commit 5cf14ce074

View File

@ -128,7 +128,8 @@ size_t BUF_MEM_grow(BUF_MEM *str, size_t len)
return (len); return (len);
} }
if (str->max >= 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; str->length = len;
return (len); return (len);
} }
@ -160,7 +161,8 @@ size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
size_t n; size_t n;
if (str->length >= len) { 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; str->length = len;
return (len); return (len);
} }