From c2a54017d73080f97c5cd34a78ff2fb51564aade Mon Sep 17 00:00:00 2001 From: Marti Maria Date: Tue, 23 Jan 2024 22:01:16 +0100 Subject: [PATCH] Filed a codeQL bug and clarified the comment More info for codeQL --- utils/transicc/transicc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/utils/transicc/transicc.c b/utils/transicc/transicc.c index 46653b8f..f52594d4 100644 --- a/utils/transicc/transicc.c +++ b/utils/transicc/transicc.c @@ -640,10 +640,9 @@ void GetLine(char* Buffer, const char* frm, ...) if (xisatty(stdin)) vfprintf(stderr, frm, args); - res = scanf("%4095s", Buffer); - // An amazing bug of codeQL here. It reports: - // 'The result of scanf is only checked against 0, but it can also return EOF." - // Not only is not compared against zero, it happens that C99 requires EOF to be negative! + res = scanf("%4095s", Buffer); + // Reported codeQL bug: 'The result of scanf is only checked against 0, but it can also return EOF.' + // It is not obviously "only checked against 0", but it happens that C99 requires EOF to be negative if (res < 0 || toupper(Buffer[0]) == 'Q') { // Quit? CloseTransforms();