From 9b96f49505daf0d43ea28bc58920d55c4ac3b30c Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Mon, 16 Mar 2026 00:07:09 -0600 Subject: [PATCH] check return value of fwrite in test case --- tests/api.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/api.c b/tests/api.c index b6037309da..635eff2096 100644 --- a/tests/api.c +++ b/tests/api.c @@ -33583,7 +33583,10 @@ static int test_lms_write_key(const byte* priv, word32 privSz, void* context) FILE* f = fopen((const char*)context, "wb"); if (f == NULL) return -1; - fwrite(priv, 1, privSz, f); + if (fwrite(priv, 1, privSz, f) != privSz) { + fclose(f); + return -1; + } fclose(f); return WC_LMS_RC_SAVED_TO_NV_MEMORY; }