summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2019-05-12 15:56:31 +0000
committertb <>2019-05-12 15:56:31 +0000
commit04e9acdb7805182f7e4b81d1fe4ae31dd77784eb (patch)
treec3d25a2720169169bb0d9934fd3928a1f95c133b
parent8ee3ded1c34d8cad25e768feb22b4887c8a5e11c (diff)
downloadopenbsd-04e9acdb7805182f7e4b81d1fe4ae31dd77784eb.tar.gz
openbsd-04e9acdb7805182f7e4b81d1fe4ae31dd77784eb.tar.bz2
openbsd-04e9acdb7805182f7e4b81d1fe4ae31dd77784eb.zip
Fix signed overflow in X509_CRL_print().
fixes oss-fuzz #14558 ok beck jsing
-rw-r--r--src/lib/libcrypto/asn1/t_crl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/t_crl.c b/src/lib/libcrypto/asn1/t_crl.c
index c8122442bb..057b8fe311 100644
--- a/src/lib/libcrypto/asn1/t_crl.c
+++ b/src/lib/libcrypto/asn1/t_crl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t_crl.c,v 1.17 2017/01/29 17:49:22 beck Exp $ */ 1/* $OpenBSD: t_crl.c,v 1.18 2019/05/12 15:56:31 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -57,6 +57,7 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <limits.h>
60 61
61#include <openssl/bn.h> 62#include <openssl/bn.h>
62#include <openssl/buffer.h> 63#include <openssl/buffer.h>
@@ -92,6 +93,8 @@ X509_CRL_print(BIO *out, X509_CRL *x)
92 93
93 BIO_printf(out, "Certificate Revocation List (CRL):\n"); 94 BIO_printf(out, "Certificate Revocation List (CRL):\n");
94 l = X509_CRL_get_version(x); 95 l = X509_CRL_get_version(x);
96 if (l < 0 || l == LONG_MAX)
97 goto err;
95 BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l); 98 BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l);
96 i = OBJ_obj2nid(x->sig_alg->algorithm); 99 i = OBJ_obj2nid(x->sig_alg->algorithm);
97 if (X509_signature_print(out, x->sig_alg, NULL) == 0) 100 if (X509_signature_print(out, x->sig_alg, NULL) == 0)