From b197257d71694fd52ab61d173f77c8a120d3eead Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Mon, 22 Aug 2016 23:39:28 +0100 Subject: Check for error return from ASN1_object_size Otherwise we try to malloc a -1 size. Reviewed-by: Tim Hudson --- crypto/ocsp/ocsp_ext.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crypto/ocsp/ocsp_ext.c b/crypto/ocsp/ocsp_ext.c index 151cafaca4..e60a8d3677 100644 --- a/crypto/ocsp/ocsp_ext.c +++ b/crypto/ocsp/ocsp_ext.c @@ -256,6 +256,9 @@ static int ocsp_add1_nonce(STACK_OF(X509_EXTENSION) **exts, * relies on library internals. */ os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING); + if (os.length < 0) + goto err; + os.data = OPENSSL_malloc(os.length); if (os.data == NULL) goto err; -- cgit v1.2.3