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:
parent
c7c7a8e601
commit
e1ca9e1f6d
1 changed files with 4 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue