diff options
| author | markus <> | 2003-02-21 12:39:17 +0000 |
|---|---|---|
| committer | markus <> | 2003-02-21 12:39:17 +0000 |
| commit | 449a81d8ab21ae7082ab3e22e14f32e3dcb513b0 (patch) | |
| tree | c96b611137a6da7c2c99629146193d2fa8a931b9 /src | |
| parent | f6d63f0a81b38a2d67959dee24550672ef05f5e3 (diff) | |
| download | openbsd-449a81d8ab21ae7082ab3e22e14f32e3dcb513b0.tar.gz openbsd-449a81d8ab21ae7082ab3e22e14f32e3dcb513b0.tar.bz2 openbsd-449a81d8ab21ae7082ab3e22e14f32e3dcb513b0.zip | |
check for size < 0 when allocating memory, from openssl (-r1.34)
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/mem.c | 6 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/mem.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/libcrypto/mem.c b/src/lib/libcrypto/mem.c index a7826908e6..87d0ebc714 100644 --- a/src/lib/libcrypto/mem.c +++ b/src/lib/libcrypto/mem.c | |||
| @@ -251,6 +251,8 @@ void *CRYPTO_malloc_locked(int num, const char *file, int line) | |||
| 251 | { | 251 | { |
| 252 | void *ret = NULL; | 252 | void *ret = NULL; |
| 253 | 253 | ||
| 254 | if (num < 0) return NULL; | ||
| 255 | |||
| 254 | allow_customize = 0; | 256 | allow_customize = 0; |
| 255 | if (malloc_debug_func != NULL) | 257 | if (malloc_debug_func != NULL) |
| 256 | { | 258 | { |
| @@ -283,6 +285,8 @@ void *CRYPTO_malloc(int num, const char *file, int line) | |||
| 283 | { | 285 | { |
| 284 | void *ret = NULL; | 286 | void *ret = NULL; |
| 285 | 287 | ||
| 288 | if (num < 0) return NULL; | ||
| 289 | |||
| 286 | allow_customize = 0; | 290 | allow_customize = 0; |
| 287 | if (malloc_debug_func != NULL) | 291 | if (malloc_debug_func != NULL) |
| 288 | { | 292 | { |
| @@ -306,6 +310,8 @@ void *CRYPTO_realloc(void *str, int num, const char *file, int line) | |||
| 306 | if (str == NULL) | 310 | if (str == NULL) |
| 307 | return CRYPTO_malloc(num, file, line); | 311 | return CRYPTO_malloc(num, file, line); |
| 308 | 312 | ||
| 313 | if (num < 0) return NULL; | ||
| 314 | |||
| 309 | if (realloc_debug_func != NULL) | 315 | if (realloc_debug_func != NULL) |
| 310 | realloc_debug_func(str, NULL, num, file, line, 0); | 316 | realloc_debug_func(str, NULL, num, file, line, 0); |
| 311 | ret = realloc_ex_func(str,num,file,line); | 317 | ret = realloc_ex_func(str,num,file,line); |
diff --git a/src/lib/libssl/src/crypto/mem.c b/src/lib/libssl/src/crypto/mem.c index a7826908e6..87d0ebc714 100644 --- a/src/lib/libssl/src/crypto/mem.c +++ b/src/lib/libssl/src/crypto/mem.c | |||
| @@ -251,6 +251,8 @@ void *CRYPTO_malloc_locked(int num, const char *file, int line) | |||
| 251 | { | 251 | { |
| 252 | void *ret = NULL; | 252 | void *ret = NULL; |
| 253 | 253 | ||
| 254 | if (num < 0) return NULL; | ||
| 255 | |||
| 254 | allow_customize = 0; | 256 | allow_customize = 0; |
| 255 | if (malloc_debug_func != NULL) | 257 | if (malloc_debug_func != NULL) |
| 256 | { | 258 | { |
| @@ -283,6 +285,8 @@ void *CRYPTO_malloc(int num, const char *file, int line) | |||
| 283 | { | 285 | { |
| 284 | void *ret = NULL; | 286 | void *ret = NULL; |
| 285 | 287 | ||
| 288 | if (num < 0) return NULL; | ||
| 289 | |||
| 286 | allow_customize = 0; | 290 | allow_customize = 0; |
| 287 | if (malloc_debug_func != NULL) | 291 | if (malloc_debug_func != NULL) |
| 288 | { | 292 | { |
| @@ -306,6 +310,8 @@ void *CRYPTO_realloc(void *str, int num, const char *file, int line) | |||
| 306 | if (str == NULL) | 310 | if (str == NULL) |
| 307 | return CRYPTO_malloc(num, file, line); | 311 | return CRYPTO_malloc(num, file, line); |
| 308 | 312 | ||
| 313 | if (num < 0) return NULL; | ||
| 314 | |||
| 309 | if (realloc_debug_func != NULL) | 315 | if (realloc_debug_func != NULL) |
| 310 | realloc_debug_func(str, NULL, num, file, line, 0); | 316 | realloc_debug_func(str, NULL, num, file, line, 0); |
| 311 | ret = realloc_ex_func(str,num,file,line); | 317 | ret = realloc_ex_func(str,num,file,line); |
