fixed DoS vulnerability in the parsing of distinguished names
This commit is contained in:
@@ -296,6 +296,11 @@ size_t asn1_length(chunk_t *blob)
|
|||||||
len = 256*len + *blob->ptr++;
|
len = 256*len + *blob->ptr++;
|
||||||
blob->len--;
|
blob->len--;
|
||||||
}
|
}
|
||||||
|
if (len > blob->len)
|
||||||
|
{
|
||||||
|
DBG2("length is larger than remaining blob size");
|
||||||
|
return ASN1_INVALID_LENGTH;
|
||||||
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ static bool iterate(private_asn1_parser_t *this, int *objectID, chunk_t *object)
|
|||||||
|
|
||||||
blob1->len = asn1_length(blob);
|
blob1->len = asn1_length(blob);
|
||||||
|
|
||||||
if (blob1->len == ASN1_INVALID_LENGTH || blob->len < blob1->len)
|
if (blob1->len == ASN1_INVALID_LENGTH)
|
||||||
{
|
{
|
||||||
DBG1("L%d - %s: length of ASN.1 object invalid or too large",
|
DBG1("L%d - %s: length of ASN.1 object invalid or too large",
|
||||||
level, obj.name);
|
level, obj.name);
|
||||||
|
|||||||
Reference in New Issue
Block a user