Skip to content

Commit

Permalink
Filed a codeQL bug and clarified the comment
Browse files Browse the repository at this point in the history
More info for codeQL
  • Loading branch information
mm2 committed Jan 23, 2024
1 parent d2f5a15 commit c2a5401
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions utils/transicc/transicc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit c2a5401

Please sign in to comment.