diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-07-16 02:14:49 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-07-16 02:14:49 +0000 |
commit | 560f3efb4339af6ec81b0aca786e31f5585feaa6 (patch) | |
tree | 48164cb4b9062b34b43b975dc2a3b4db03aef284 /lib | |
parent | 7c8c359c8a3e6086dc5d40517437c622cf6fe39e (diff) |
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.c | 7 |
1 files changed, 4 insertions, 3 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); |