summaryrefslogtreecommitdiff
path: root/lib/libcrypto/pem/pem_info.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2015-02-10 09:52:36 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2015-02-10 09:52:36 +0000
commit935f03f76968db2c0995f02b41a6492af33d2bb7 (patch)
treedcfcece8bb55f1dd0d507cd28fc0b2d7e521cbb5 /lib/libcrypto/pem/pem_info.c
parent4d1e129bc35db3808a66758bef982d7f8be0f5bf (diff)
Replace assert() and OPENSSL_assert() calls with proper error return paths.
Careful review, feedback & ok doug@ jsing@
Diffstat (limited to 'lib/libcrypto/pem/pem_info.c')
-rw-r--r--lib/libcrypto/pem/pem_info.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libcrypto/pem/pem_info.c b/lib/libcrypto/pem/pem_info.c
index 9ddcb565969..6fe72ce742e 100644
--- a/lib/libcrypto/pem/pem_info.c
+++ b/lib/libcrypto/pem/pem_info.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pem_info.c,v 1.19 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: pem_info.c,v 1.20 2015/02/10 09:52:35 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -361,8 +361,12 @@ PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
}
/* create the right magic header stuff */
- OPENSSL_assert(strlen(objstr) + 23 +
- 2 * enc->iv_len + 13 <= sizeof buf);
+ if (strlen(objstr) + 23 + 2 * enc->iv_len + 13 >
+ sizeof buf) {
+ PEMerr(PEM_F_PEM_X509_INFO_WRITE_BIO,
+ ASN1_R_BUFFER_TOO_SMALL);
+ goto err;
+ }
buf[0] = '\0';
PEM_proc_type(buf, PEM_TYPE_ENCRYPTED);
PEM_dek_info(buf, objstr, enc->iv_len, (char *)iv);