add null checks for function arguments that return BAD_FUNC_ARG

update function comment
This commit is contained in:
Ruby Martin
2025-08-06 15:06:31 -06:00
parent f5a4b13391
commit 9e3f726b0e
2 changed files with 22 additions and 1 deletions
+5
View File
@@ -715,6 +715,11 @@ int SizeASN_Items(const ASNItem* asn, ASNSetData *data, int count, int* encSz)
WOLFSSL_ENTER("SizeASN_Items");
#endif
if (asn == NULL || data == NULL || count <= 0 || encSz == NULL) {
WOLFSSL_MSG("bad arguments in SizeASN_Items");
return BAD_FUNC_ARG;
}
for (i = count - 1; i >= 0; i--) {
/* Skip this ASN.1 item when encoding. */
if (data[i].noOut) {