summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);