diff options
| author | miod <> | 2015-07-20 15:43:23 +0000 |
|---|---|---|
| committer | miod <> | 2015-07-20 15:43:23 +0000 |
| commit | 7062d91530e6dcda56380eb82838a24a9804c3b5 (patch) | |
| tree | a0984651c39136da3b989877a4aa3734d2a8e692 /src/lib/libc | |
| parent | 3cb5ee28c19b8a617f1917a1ef0282fefdecbf9f (diff) | |
| download | openbsd-7062d91530e6dcda56380eb82838a24a9804c3b5.tar.gz openbsd-7062d91530e6dcda56380eb82838a24a9804c3b5.tar.bz2 openbsd-7062d91530e6dcda56380eb82838a24a9804c3b5.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 '')
| -rw-r--r-- | src/lib/libcrypto/asn1/tasn_new.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_new.c b/src/lib/libcrypto/asn1/tasn_new.c index 132df07637..986e5811b6 100644 --- a/src/lib/libcrypto/asn1/tasn_new.c +++ b/src/lib/libcrypto/asn1/tasn_new.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tasn_new.c,v 1.14 2015/02/14 15:23:57 miod Exp $ */ | 1 | /* $OpenBSD: tasn_new.c,v 1.15 2015/07/20 15:43:23 miod 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 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -313,7 +313,7 @@ ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | if (!it || (it->itype == ASN1_ITYPE_MSTRING)) | 315 | if (!it || (it->itype == ASN1_ITYPE_MSTRING)) |
| 316 | utype = -1; | 316 | utype = V_ASN1_UNDEF; |
| 317 | else | 317 | else |
| 318 | utype = it->utype; | 318 | utype = it->utype; |
| 319 | switch (utype) { | 319 | switch (utype) { |
| @@ -331,10 +331,10 @@ ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
| 331 | 331 | ||
| 332 | case V_ASN1_ANY: | 332 | case V_ASN1_ANY: |
| 333 | typ = malloc(sizeof(ASN1_TYPE)); | 333 | typ = malloc(sizeof(ASN1_TYPE)); |
| 334 | if (!typ) | 334 | if (typ != NULL) { |
| 335 | return 0; | 335 | typ->value.ptr = NULL; |
| 336 | typ->value.ptr = NULL; | 336 | typ->type = V_ASN1_UNDEF; |
| 337 | typ->type = -1; | 337 | } |
| 338 | *pval = (ASN1_VALUE *)typ; | 338 | *pval = (ASN1_VALUE *)typ; |
| 339 | break; | 339 | break; |
| 340 | 340 | ||
| @@ -364,7 +364,7 @@ asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
| 364 | return; | 364 | return; |
| 365 | } | 365 | } |
| 366 | if (!it || (it->itype == ASN1_ITYPE_MSTRING)) | 366 | if (!it || (it->itype == ASN1_ITYPE_MSTRING)) |
| 367 | utype = -1; | 367 | utype = V_ASN1_UNDEF; |
| 368 | else | 368 | else |
| 369 | utype = it->utype; | 369 | utype = it->utype; |
| 370 | if (utype == V_ASN1_BOOLEAN) | 370 | if (utype == V_ASN1_BOOLEAN) |
