diff options
| author | djm <> | 2012-10-13 21:23:58 +0000 |
|---|---|---|
| committer | djm <> | 2012-10-13 21:23:58 +0000 |
| commit | adb31f466163d59ad933cf9d299ce6c610f1cff3 (patch) | |
| tree | cfb338ea736543eb88bd6c3f56f007ecb05dce51 /src/lib/libcrypto/mem.c | |
| parent | 767ddad28eb81a703656eed39ed362c83ac9e20a (diff) | |
| download | openbsd-adb31f466163d59ad933cf9d299ce6c610f1cff3.tar.gz openbsd-adb31f466163d59ad933cf9d299ce6c610f1cff3.tar.bz2 openbsd-adb31f466163d59ad933cf9d299ce6c610f1cff3.zip | |
import OpenSSL-1.0.1c
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/mem.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/libcrypto/mem.c b/src/lib/libcrypto/mem.c index 6f80dd33eb..21c0011380 100644 --- a/src/lib/libcrypto/mem.c +++ b/src/lib/libcrypto/mem.c | |||
| @@ -125,6 +125,7 @@ static long (*get_debug_options_func)(void) = NULL; | |||
| 125 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), | 125 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), |
| 126 | void (*f)(void *)) | 126 | void (*f)(void *)) |
| 127 | { | 127 | { |
| 128 | OPENSSL_init(); | ||
| 128 | if (!allow_customize) | 129 | if (!allow_customize) |
| 129 | return 0; | 130 | return 0; |
| 130 | if ((m == 0) || (r == 0) || (f == 0)) | 131 | if ((m == 0) || (r == 0) || (f == 0)) |
| @@ -186,6 +187,7 @@ int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int), | |||
| 186 | { | 187 | { |
| 187 | if (!allow_customize_debug) | 188 | if (!allow_customize_debug) |
| 188 | return 0; | 189 | return 0; |
| 190 | OPENSSL_init(); | ||
| 189 | malloc_debug_func=m; | 191 | malloc_debug_func=m; |
| 190 | realloc_debug_func=r; | 192 | realloc_debug_func=r; |
| 191 | free_debug_func=f; | 193 | free_debug_func=f; |
| @@ -361,6 +363,10 @@ void *CRYPTO_realloc_clean(void *str, int old_len, int num, const char *file, | |||
| 361 | 363 | ||
| 362 | if (num <= 0) return NULL; | 364 | if (num <= 0) return NULL; |
| 363 | 365 | ||
| 366 | /* We don't support shrinking the buffer. Note the memcpy that copies | ||
| 367 | * |old_len| bytes to the new buffer, below. */ | ||
| 368 | if (num < old_len) return NULL; | ||
| 369 | |||
| 364 | if (realloc_debug_func != NULL) | 370 | if (realloc_debug_func != NULL) |
| 365 | realloc_debug_func(str, NULL, num, file, line, 0); | 371 | realloc_debug_func(str, NULL, num, file, line, 0); |
| 366 | ret=malloc_ex_func(num,file,line); | 372 | ret=malloc_ex_func(num,file,line); |
