diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index ee019dc50..174f62e04 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -18975,6 +18975,8 @@ static int DecodeAltNames(const byte* input, word32 sz, DecodedCert* cert) } while ((ret == 0) && (idx < sz)) { + ASNGetData dataASN[altNameASN_Length]; + numNames++; if (numNames > WOLFSSL_MAX_ALT_NAMES) { WOLFSSL_MSG("\tToo many subject alternative names"); @@ -18982,8 +18984,6 @@ static int DecodeAltNames(const byte* input, word32 sz, DecodedCert* cert) break; } - ASNGetData dataASN[altNameASN_Length]; - /* Clear dynamic data items. */ XMEMSET(dataASN, 0, sizeof(dataASN)); /* Parse GeneralName with the choices supported. */