diff options
| author | miod <> | 2015-07-16 02:14:48 +0000 |
|---|---|---|
| committer | miod <> | 2015-07-16 02:14:48 +0000 |
| commit | af5c71535f905bdf9ebd1db46a42dad5a462d2c4 (patch) | |
| tree | 6ef6cff138840b8a3151be57a5120bd84fabc55f /src | |
| parent | 6388571b7b0457dd683da7be375e4539d954f939 (diff) | |
| download | openbsd-af5c71535f905bdf9ebd1db46a42dad5a462d2c4.tar.gz openbsd-af5c71535f905bdf9ebd1db46a42dad5a462d2c4.tar.bz2 openbsd-af5c71535f905bdf9ebd1db46a42dad5a462d2c4.zip | |
Make sure the `reject negative sizes' logic introduced in 1.34 is actually
applied to all code paths.
ok beck@ bcook@ doug@ guenther@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/pem/pem_lib.c | 7 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/pem/pem_lib.c | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c index 48768a4467..221b308d71 100644 --- a/src/lib/libcrypto/pem/pem_lib.c +++ b/src/lib/libcrypto/pem/pem_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem_lib.c,v 1.39 2015/02/11 04:05:14 beck Exp $ */ | 1 | /* $OpenBSD: pem_lib.c,v 1.40 2015/07/16 02:14:48 miod Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -94,10 +94,11 @@ PEM_def_callback(char *buf, int num, int w, void *key) | |||
| 94 | int i; | 94 | int i; |
| 95 | const char *prompt; | 95 | const char *prompt; |
| 96 | 96 | ||
| 97 | if (num < 0) | ||
| 98 | return -1; | ||
| 99 | |||
| 97 | if (key) { | 100 | if (key) { |
| 98 | l = strlen(key); | 101 | l = strlen(key); |
| 99 | if (num < 0) | ||
| 100 | return -1; | ||
| 101 | if (l > (size_t)num) | 102 | if (l > (size_t)num) |
| 102 | l = (size_t)num; | 103 | l = (size_t)num; |
| 103 | memcpy(buf, key, l); | 104 | memcpy(buf, key, l); |
diff --git a/src/lib/libssl/src/crypto/pem/pem_lib.c b/src/lib/libssl/src/crypto/pem/pem_lib.c index 48768a4467..221b308d71 100644 --- a/src/lib/libssl/src/crypto/pem/pem_lib.c +++ b/src/lib/libssl/src/crypto/pem/pem_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem_lib.c,v 1.39 2015/02/11 04:05:14 beck Exp $ */ | 1 | /* $OpenBSD: pem_lib.c,v 1.40 2015/07/16 02:14:48 miod Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -94,10 +94,11 @@ PEM_def_callback(char *buf, int num, int w, void *key) | |||
| 94 | int i; | 94 | int i; |
| 95 | const char *prompt; | 95 | const char *prompt; |
| 96 | 96 | ||
| 97 | if (num < 0) | ||
| 98 | return -1; | ||
| 99 | |||
| 97 | if (key) { | 100 | if (key) { |
| 98 | l = strlen(key); | 101 | l = strlen(key); |
| 99 | if (num < 0) | ||
| 100 | return -1; | ||
| 101 | if (l > (size_t)num) | 102 | if (l > (size_t)num) |
| 102 | l = (size_t)num; | 103 | l = (size_t)num; |
| 103 | memcpy(buf, key, l); | 104 | memcpy(buf, key, l); |
