summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2015-07-16 02:14:48 +0000
committermiod <miod@openbsd.org>2015-07-16 02:14:48 +0000
commit719f85012079830a872eebe23c3e000358095798 (patch)
tree76257fd4df9318dfd42eb9ec42c37cd87b21cbbe /lib
parentremove dead files (moved from unbound/ldns/ to unbound/sldns/) (diff)
downloadwireguard-openbsd-719f85012079830a872eebe23c3e000358095798.tar.xz
wireguard-openbsd-719f85012079830a872eebe23c3e000358095798.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 'lib')
-rw-r--r--lib/libcrypto/pem/pem_lib.c7
-rw-r--r--lib/libssl/src/crypto/pem/pem_lib.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/libcrypto/pem/pem_lib.c b/lib/libcrypto/pem/pem_lib.c
index 48768a4467d..221b308d717 100644
--- a/lib/libcrypto/pem/pem_lib.c
+++ b/lib/libcrypto/pem/pem_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pem_lib.c,v 1.39 2015/02/11 04:05:14 beck Exp $ */
+/* $OpenBSD: pem_lib.c,v 1.40 2015/07/16 02:14:48 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -94,10 +94,11 @@ PEM_def_callback(char *buf, int num, int w, void *key)
int i;
const char *prompt;
+ if (num < 0)
+ return -1;
+
if (key) {
l = strlen(key);
- if (num < 0)
- return -1;
if (l > (size_t)num)
l = (size_t)num;
memcpy(buf, key, l);
diff --git a/lib/libssl/src/crypto/pem/pem_lib.c b/lib/libssl/src/crypto/pem/pem_lib.c
index 48768a4467d..221b308d717 100644
--- a/lib/libssl/src/crypto/pem/pem_lib.c
+++ b/lib/libssl/src/crypto/pem/pem_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pem_lib.c,v 1.39 2015/02/11 04:05:14 beck Exp $ */
+/* $OpenBSD: pem_lib.c,v 1.40 2015/07/16 02:14:48 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -94,10 +94,11 @@ PEM_def_callback(char *buf, int num, int w, void *key)
int i;
const char *prompt;
+ if (num < 0)
+ return -1;
+
if (key) {
l = strlen(key);
- if (num < 0)
- return -1;
if (l > (size_t)num)
l = (size_t)num;
memcpy(buf, key, l);