diff options
author | Mark J. Cox <mark@openssl.org> | 2003-11-04 11:33:12 +0000 |
---|---|---|
committer | Mark J. Cox <mark@openssl.org> | 2003-11-04 11:33:12 +0000 |
commit | 99ed4cbb036ea9fa56725094584fec191feaa526 (patch) | |
tree | f85dfacda3e0afe30fc5f799e2c83bfca6ee8aab /crypto | |
parent | d8dae0ea36fd21f6f5a3e9e332a7c2dc227b2674 (diff) |
Stop bug triggering large recursion when presented withOpenSSL-engine-0_9_6l
certain ASN.1 tags (CAN-2003-0851)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/asn1/a_bytes.c | 13 | ||||
-rw-r--r-- | crypto/opensslv.h | 4 |
2 files changed, 9 insertions, 8 deletions
diff --git a/crypto/asn1/a_bytes.c b/crypto/asn1/a_bytes.c index 3a0c0c7835..6595255cf8 100644 --- a/crypto/asn1/a_bytes.c +++ b/crypto/asn1/a_bytes.c @@ -201,7 +201,10 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length, c.pp=pp; c.p=p; c.inf=inf; - c.slen=len; + if (inf & 1) + c.slen = length - (p - *pp); + else + c.slen=len; c.tag=Ptag; c.xclass=Pclass; c.max=(length == 0)?0:(p+length); @@ -279,8 +282,7 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c) { if (c->inf & 1) { - c->eos=ASN1_check_infinite_end(&c->p, - (long)(c->max-c->p)); + c->eos=ASN1_check_infinite_end(&c->p, c->slen); if (c->eos) break; } else @@ -289,7 +291,7 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c) } c->q=c->p; - if (d2i_ASN1_bytes(&os,&c->p,c->max-c->p,c->tag,c->xclass) + if (d2i_ASN1_bytes(&os,&c->p,c->slen,c->tag,c->xclass) == NULL) { c->error=ERR_R_ASN1_LIB; @@ -302,8 +304,7 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c) goto err; } memcpy(&(b.data[num]),os->data,os->length); - if (!(c->inf & 1)) - c->slen-=(c->p-c->q); + c->slen-=(c->p-c->q); num+=os->length; } diff --git a/crypto/opensslv.h b/crypto/opensslv.h index 0e3aabc678..6f9e4c0570 100644 --- a/crypto/opensslv.h +++ b/crypto/opensslv.h @@ -25,8 +25,8 @@ * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ -#define OPENSSL_VERSION_NUMBER 0x009060c0L -#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.6l-dev [engine] xx XXX XXXX" +#define OPENSSL_VERSION_NUMBER 0x009060cfL +#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.6l [engine] 04 Nov 2003" #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT |