From 7865adcb9cc18bc787d4561eb34ec3b2dee1565d Mon Sep 17 00:00:00 2001 From: jsteube Date: Wed, 4 Oct 2023 09:32:05 +0000 Subject: [PATCH] Fix missing check for fread() in combinatorX.c --- src/combinatorX.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/combinatorX.c b/src/combinatorX.c index 9bbb30c..389813f 100644 --- a/src/combinatorX.c +++ b/src/combinatorX.c @@ -304,7 +304,12 @@ static bool session_init (bool session, bool restore) return false; } char buf[4] = { 0 }; - fread (buf, 3, 1, main_ctx.sfp[0]); + int nread=fread (buf, 3, 1, main_ctx.sfp[0]); + if (nread != 3) + { + fprintf (stderr, "! fread() failed (%d): %s\n", errno, strerror (errno)); + return false; + } if (!strcmp(buf, "end")) { fprintf (stdout, "This session has already ended.\n");