Skip to content

Commit 4894d38

Browse files
moshekaplandanmar
authored andcommitted
Improved invalidScanf error message
1 parent f2fdc4f commit 4894d38

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/checkio.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,12 @@ void CheckIO::invalidScanfError(const Token *tok, bool portability)
426426
" return 0;\n"
427427
"}\n"
428428
"\n"
429-
"To make it crash, type in more than 5 characters.");
429+
"Typing in 5 or more characters may make the program crash. The correct usage "
430+
"here is 'scanf(\"%4s\", c);', as the maximum field width does not include the "
431+
"terminating null byte.\n"
432+
"Source: http://linux.die.net/man/3/scanf\n"
433+
"Source: http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/libkern/stdio/scanf.c"
434+
);
430435
}
431436

432437
//---------------------------------------------------------------------------

0 commit comments

Comments
 (0)