From 7d82c4e3f201c23699e60d74b99133686a58c0d5 Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Thu, 9 Apr 2020 16:49:52 -0500 Subject: [PATCH] Adding check for invalid SAN ext with no entries --- wolfcrypt/src/asn.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index d6e58946e..d91fbdc1e 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -7635,6 +7635,13 @@ static int DecodeAltNames(const byte* input, int sz, DecodedCert* cert) return ASN_PARSE_E; } + if (length == 0) { + /* RFC 5280 4.2.1.6. Subject Alternative Name + If the subjectAltName extension is present, the sequence MUST + contain at least one entry. */ + return ASN_PARSE_E; + } + cert->weOwnAltNames = 1; while (length > 0) {