diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2014-04-17 16:31:00 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2014-04-17 16:31:00 +0000 |
commit | 75a2069c66d04873a144e4cc5cfd9e786cfbe18c (patch) | |
tree | 66660f0b51a804d5142c9ce4bd3b4545039d9c05 /lib/libcrypto | |
parent | cea1283b1a47276f012eac890ee0ebdf611bd0e9 (diff) |
remove OPENSSL_realloc_clean usage here - replace with intrinsics to make
it obvious what should happen.
ok tedu@
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/buffer/buffer.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libcrypto/buffer/buffer.c b/lib/libcrypto/buffer/buffer.c index 4bd55c04ae5..a50c30a3485 100644 --- a/lib/libcrypto/buffer/buffer.c +++ b/lib/libcrypto/buffer/buffer.c @@ -153,10 +153,13 @@ BUF_MEM_grow_clean(BUF_MEM *str, size_t len) return 0; } n = (len + 3) / 3 * 4; - if (str->data == NULL) - ret = malloc(n); - else - ret = OPENSSL_realloc_clean(str->data, str->max, n); + ret = malloc(n); + /* we're not shrinking - that case returns above */ + if ((ret != NULL) && (str->data != NULL)) { + memcpy(ret, str->data, str->max); + explicit_bzero(str->data, str->max); + free(str->data); + } if (ret == NULL) { BUFerr(BUF_F_BUF_MEM_GROW_CLEAN, ERR_R_MALLOC_FAILURE); len = 0; |