summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2015-07-20 15:43:23 +0000
committermiod <miod@openbsd.org>2015-07-20 15:43:23 +0000
commit5b0e29d3b727968a89a856a5e63242ff27fac3f0 (patch)
tree02c48c8ae8f0f7e8be8b581b7ca541e0bf39cebc /lib/libssl/src
parentCheck the return value of asn1_enc_save(). ok bcook@ doug@ (diff)
downloadwireguard-openbsd-5b0e29d3b727968a89a856a5e63242ff27fac3f0.tar.xz
wireguard-openbsd-5b0e29d3b727968a89a856a5e63242ff27fac3f0.zip
Use V_ASN1_UNDEF instead of -1.
Make sure ASN1_primitive_new() will return NULL in *pval in all error situations. ok bcook@ doug@
Diffstat (limited to 'lib/libssl/src')
-rw-r--r--lib/libssl/src/crypto/asn1/tasn_new.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libssl/src/crypto/asn1/tasn_new.c b/lib/libssl/src/crypto/asn1/tasn_new.c
index 132df07637f..986e5811b6c 100644
--- a/lib/libssl/src/crypto/asn1/tasn_new.c
+++ b/lib/libssl/src/crypto/asn1/tasn_new.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tasn_new.c,v 1.14 2015/02/14 15:23:57 miod Exp $ */
+/* $OpenBSD: tasn_new.c,v 1.15 2015/07/20 15:43:23 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
@@ -313,7 +313,7 @@ ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
}
if (!it || (it->itype == ASN1_ITYPE_MSTRING))
- utype = -1;
+ utype = V_ASN1_UNDEF;
else
utype = it->utype;
switch (utype) {
@@ -331,10 +331,10 @@ ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
case V_ASN1_ANY:
typ = malloc(sizeof(ASN1_TYPE));
- if (!typ)
- return 0;
- typ->value.ptr = NULL;
- typ->type = -1;
+ if (typ != NULL) {
+ typ->value.ptr = NULL;
+ typ->type = V_ASN1_UNDEF;
+ }
*pval = (ASN1_VALUE *)typ;
break;
@@ -364,7 +364,7 @@ asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
return;
}
if (!it || (it->itype == ASN1_ITYPE_MSTRING))
- utype = -1;
+ utype = V_ASN1_UNDEF;
else
utype = it->utype;
if (utype == V_ASN1_BOOLEAN)