summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2017-07-09 21:22:26 +0200
committerBernd Edlinger <bernd.edlinger@hotmail.de>2017-07-10 16:25:43 +0200
commite1ca9e1f6db97052a0ebea6591f323b12b1e0020 (patch)
tree036ad14dcac245a1d38e16dab81b58e49dceed63 /crypto
parentOptimize sha/asm/keccak1600-avx2.pl. (diff)
downloadopenssl-e1ca9e1f6db97052a0ebea6591f323b12b1e0020.tar.xz
openssl-e1ca9e1f6db97052a0ebea6591f323b12b1e0020.zip
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)
Diffstat (limited to 'crypto')
-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 6b0bd4a404..ad7128a732 100644
--- a/crypto/buffer/buffer.c
+++ b/crypto/buffer/buffer.c
@@ -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);
}