aboutsummaryrefslogtreecommitdiff
path: root/openssl/crypto/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'openssl/crypto/mem.c')
-rw-r--r--openssl/crypto/mem.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/openssl/crypto/mem.c b/openssl/crypto/mem.c
index 8f736c3b1..21c001138 100644
--- a/openssl/crypto/mem.c
+++ b/openssl/crypto/mem.c
@@ -363,6 +363,10 @@ void *CRYPTO_realloc_clean(void *str, int old_len, int num, const char *file,
if (num <= 0) return NULL;
+ /* We don't support shrinking the buffer. Note the memcpy that copies
+ * |old_len| bytes to the new buffer, below. */
+ if (num < old_len) return NULL;
+
if (realloc_debug_func != NULL)
realloc_debug_func(str, NULL, num, file, line, 0);
ret=malloc_ex_func(num,file,line);