aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1/tasn_dec.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2000-12-31 01:13:04 +0000
committerDr. Stephen Henson <steve@openssl.org>2000-12-31 01:13:04 +0000
commitecbe07817ab8fff2aca97eeb69fabdd5c54b4bda (patch)
tree71a101c30b45069272befb805c9b285059a4cd4b /crypto/asn1/tasn_dec.c
parent71db02813c8d1ac2901be397ee4aa5f4dceabb17 (diff)
downloadopenssl-ecbe07817ab8fff2aca97eeb69fabdd5c54b4bda.tar.gz
Rewrite PKCS#12 code and remove some of the old
horrible macros. Fix two evil ASN1 bugs. Attempt to use 'ctx' when NULL if input is indefinite length constructed in asn1_check_tlen() and invalid pointer to ASN1_TYPE when reusing existing structure (this took *ages* to find because the new PKCS#12 code triggered it).
Diffstat (limited to 'crypto/asn1/tasn_dec.c')
-rw-r--r--crypto/asn1/tasn_dec.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c
index 940e6af6b3..15ebf267f2 100644
--- a/crypto/asn1/tasn_dec.c
+++ b/crypto/asn1/tasn_dec.c
@@ -658,7 +658,7 @@ int asn1_ex_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char
if(!*pval) {
typ = ASN1_TYPE_new();
*pval = (ASN1_VALUE *)typ;
- } else typ = (ASN1_TYPE *)pval;
+ } else typ = (ASN1_TYPE *)*pval;
if(utype != typ->type) ASN1_TYPE_set(typ, utype, NULL);
pval = (ASN1_VALUE **)&typ->value.ptr;
}
@@ -865,14 +865,14 @@ static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, char *i
ctx->ptag = ptag;
ctx->hdrlen = p - q;
ctx->valid = 1;
- }
- /* If definite length, length + header can't exceed total
- * amount of data available.
- */
- if(!(i & 1) && ((plen + ctx->hdrlen) > len)) {
- ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_TOO_LONG);
- asn1_tlc_clear(ctx);
- return 0;
+ /* If definite length, length + header can't exceed total
+ * amount of data available.
+ */
+ if(!(i & 1) && ((plen + ctx->hdrlen) > len)) {
+ ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_TOO_LONG);
+ asn1_tlc_clear(ctx);
+ return 0;
+ }
}
}