Skip to content

Commit 9b96f49

Browse files
check return value of fwrite in test case
1 parent 681fb41 commit 9b96f49

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/api.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33583,7 +33583,10 @@ static int test_lms_write_key(const byte* priv, word32 privSz, void* context)
3358333583
FILE* f = fopen((const char*)context, "wb");
3358433584
if (f == NULL)
3358533585
return -1;
33586-
fwrite(priv, 1, privSz, f);
33586+
if (fwrite(priv, 1, privSz, f) != privSz) {
33587+
fclose(f);
33588+
return -1;
33589+
}
3358733590
fclose(f);
3358833591
return WC_LMS_RC_SAVED_TO_NV_MEMORY;
3358933592
}

0 commit comments

Comments
 (0)