Fix crash in BUF_MEM_grow_clean.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/3896)
This commit is contained in:
Bernd Edlinger 2017-07-09 21:22:26 +02:00
parent c7c7a8e601
commit e1ca9e1f6d

View file

@ -62,9 +62,11 @@ static char *sec_alloc_realloc(BUF_MEM *str, size_t len)
ret = OPENSSL_secure_malloc(len);
if (str->data != NULL) {
if (ret != NULL)
if (ret != NULL) {
memcpy(ret, str->data, str->length);
OPENSSL_secure_free(str->data);
OPENSSL_secure_free(str->data);
str->data = NULL;
}
}
return (ret);
}