summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2015-02-15 08:45:27 +0000
committermiod <miod@openbsd.org>2015-02-15 08:45:27 +0000
commitbd2588f2f301b5a5ec86c6fd7d20607c9bf53b9f (patch)
tree85ff0d7a8c236bdb94dba82bc3a2ec34f378fa64 /lib/libssl/src
parentIn ec_wNAF_mul(), move the declaration of tmp_wNAF higher in scope, so that (diff)
downloadwireguard-openbsd-bd2588f2f301b5a5ec86c6fd7d20607c9bf53b9f.tar.xz
wireguard-openbsd-bd2588f2f301b5a5ec86c6fd7d20607c9bf53b9f.zip
Check ASN1_OCTET_STRING_new() for failure. Coverity CID 78904
ok doug@
Diffstat (limited to 'lib/libssl/src')
-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;