diff options
author | miod <> | 2015-02-10 09:52:35 +0000 |
---|---|---|
committer | miod <> | 2015-02-10 09:52:35 +0000 |
commit | d2f68f95d95ff1ca4370b66eb67e8add10d9d079 (patch) | |
tree | 58f7f299c05557099d7278079e061aed0f4a9f23 /src/lib/libcrypto/pem/pem_info.c | |
parent | 9c8f4b278d0fe6c5ae67ecea60905c57ccf4c4e1 (diff) | |
download | openbsd-d2f68f95d95ff1ca4370b66eb67e8add10d9d079.tar.gz openbsd-d2f68f95d95ff1ca4370b66eb67e8add10d9d079.tar.bz2 openbsd-d2f68f95d95ff1ca4370b66eb67e8add10d9d079.zip |
Replace assert() and OPENSSL_assert() calls with proper error return paths.
Careful review, feedback & ok doug@ jsing@
Diffstat (limited to 'src/lib/libcrypto/pem/pem_info.c')
-rw-r--r-- | src/lib/libcrypto/pem/pem_info.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/libcrypto/pem/pem_info.c b/src/lib/libcrypto/pem/pem_info.c index 9ddcb56596..6fe72ce742 100644 --- a/src/lib/libcrypto/pem/pem_info.c +++ b/src/lib/libcrypto/pem/pem_info.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pem_info.c,v 1.19 2014/07/11 08:44:49 jsing Exp $ */ | 1 | /* $OpenBSD: pem_info.c,v 1.20 2015/02/10 09:52:35 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 | * |
@@ -361,8 +361,12 @@ PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, | |||
361 | } | 361 | } |
362 | 362 | ||
363 | /* create the right magic header stuff */ | 363 | /* create the right magic header stuff */ |
364 | OPENSSL_assert(strlen(objstr) + 23 + | 364 | if (strlen(objstr) + 23 + 2 * enc->iv_len + 13 > |
365 | 2 * enc->iv_len + 13 <= sizeof buf); | 365 | sizeof buf) { |
366 | PEMerr(PEM_F_PEM_X509_INFO_WRITE_BIO, | ||
367 | ASN1_R_BUFFER_TOO_SMALL); | ||
368 | goto err; | ||
369 | } | ||
366 | buf[0] = '\0'; | 370 | buf[0] = '\0'; |
367 | PEM_proc_type(buf, PEM_TYPE_ENCRYPTED); | 371 | PEM_proc_type(buf, PEM_TYPE_ENCRYPTED); |
368 | PEM_dek_info(buf, objstr, enc->iv_len, (char *)iv); | 372 | PEM_dek_info(buf, objstr, enc->iv_len, (char *)iv); |