summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormiod <>2015-07-16 02:14:48 +0000
committermiod <>2015-07-16 02:14:48 +0000
commit6e62847ce043c93089d341b8940940fcca3a4685 (patch)
tree6ef6cff138840b8a3151be57a5120bd84fabc55f
parentbe1d297b6ec02bf43d4fda0f2648c666dc345753 (diff)
downloadopenbsd-6e62847ce043c93089d341b8940940fcca3a4685.tar.gz
openbsd-6e62847ce043c93089d341b8940940fcca3a4685.tar.bz2
openbsd-6e62847ce043c93089d341b8940940fcca3a4685.zip
Make sure the `reject negative sizes' logic introduced in 1.34 is actually
applied to all code paths. ok beck@ bcook@ doug@ guenther@
-rw-r--r--src/lib/libcrypto/pem/pem_lib.c7
-rw-r--r--src/lib/libssl/src/crypto/pem/pem_lib.c7
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);