ASN.1: Verify that NULL value has zero length

This value is required to contain no octets, so verify that its length
octet agrees with that.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2021-03-13 23:09:28 +02:00
parent f629bfe225
commit 9bf4c0539b

View file

@ -129,6 +129,8 @@ static int asn1_valid_der(struct asn1_hdr *hdr)
return 1;
if (hdr->tag == ASN1_TAG_BOOLEAN && !asn1_valid_der_boolean(hdr))
return 0;
if (hdr->tag == ASN1_TAG_NULL && hdr->length != 0)
return 0;
return 1;
}