summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2015-02-15 08:45:28 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2015-02-15 08:45:28 +0000
commit4a73b6173e3b546065aca5cf712d129e5aa0362b (patch)
tree7c30c3ce6cba801b7b00a22a514d91cf06163c80 /lib
parent2b15254f800a3597fd9501c67dbcf64fa055a57a (diff)
Check ASN1_OCTET_STRING_new() for failure. Coverity CID 78904
ok doug@
Diffstat (limited to 'lib')
-rw-r--r--lib/libssl/src/crypto/x509v3/v3_ocsp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/libssl/src/crypto/x509v3/v3_ocsp.c b/lib/libssl/src/crypto/x509v3/v3_ocsp.c
index d606240b12f..1d9c8a85132 100644
--- a/lib/libssl/src/crypto/x509v3/v3_ocsp.c
+++ b/lib/libssl/src/crypto/x509v3/v3_ocsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: v3_ocsp.c,v 1.10 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: v3_ocsp.c,v 1.11 2015/02/15 08:45:27 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
@@ -242,21 +242,23 @@ d2i_ocsp_nonce(void *a, const unsigned char **pp, long length)
ASN1_OCTET_STRING *os, **pos;
pos = a;
- if (!pos || !*pos)
+ if (pos == NULL || *pos == NULL) {
os = ASN1_OCTET_STRING_new();
- else
+ if (os == NULL)
+ goto err;
+ } else
os = *pos;
- if (!ASN1_OCTET_STRING_set(os, *pp, length))
+ if (ASN1_OCTET_STRING_set(os, *pp, length) == 0)
goto err;
*pp += length;
- if (pos)
+ if (pos != NULL)
*pos = os;
return os;
err:
- if (os && (!pos || (*pos != os)))
+ if (pos == NULL || *pos != os)
M_ASN1_OCTET_STRING_free(os);
OCSPerr(OCSP_F_D2I_OCSP_NONCE, ERR_R_MALLOC_FAILURE);
return NULL;