which was effectively bypassed in the ASN1 changed.
unsigned char *p,*s;
int i;
+ if (len < 1)
+ {
+ i=ASN1_R_STRING_TOO_SHORT;
+ goto err;
+ }
+
if ((a == NULL) || ((*a) == NULL))
{
if ((ret=M_ASN1_BIT_STRING_new()) == NULL) return(NULL);
ctx->ptag = ptag;
ctx->hdrlen = p - q;
ctx->valid = 1;
- /* If definite length, length + header can't exceed total
- * amount of data available.
+ /* If definite length, and no error, length +
+ * header can't exceed total amount of data available.
*/
- if(!(i & 1) && ((plen + ctx->hdrlen) > len)) {
+ if(!(i & 0x81) && ((plen + ctx->hdrlen) > len)) {
ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_TOO_LONG);
asn1_tlc_clear(ctx);
return 0;