coverity: null check.

This commit is contained in:
jordan
2024-10-16 13:08:06 -05:00
parent d6fe15af8c
commit 115507e0c0

View File

@ -282,7 +282,7 @@ static int wolfssl_i2d_asn1_items(const void* obj, byte* buf,
len = 0; len = 0;
break; break;
} }
if (buf != NULL && !mem->ex && mem->tag >= 0) { if (buf != NULL && tmp != NULL && !mem->ex && mem->tag >= 0) {
/* Encode the implicit tag */ /* Encode the implicit tag */
byte imp[ASN_TAG_SZ + MAX_LENGTH_SZ]; byte imp[ASN_TAG_SZ + MAX_LENGTH_SZ];
SetImplicit(tmp[0], mem->tag, 0, imp, 0); SetImplicit(tmp[0], mem->tag, 0, imp, 0);