From 4894d3807d43f423fc686ddb7aaf842205725b31 Mon Sep 17 00:00:00 2001 From: Moshe Kaplan Date: Wed, 6 Aug 2014 06:08:28 +0200 Subject: [PATCH] Improved invalidScanf error message --- lib/checkio.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/checkio.cpp b/lib/checkio.cpp index 85da4d384..4b945cc86 100644 --- a/lib/checkio.cpp +++ b/lib/checkio.cpp @@ -426,7 +426,12 @@ void CheckIO::invalidScanfError(const Token *tok, bool portability) " return 0;\n" "}\n" "\n" - "To make it crash, type in more than 5 characters."); + "Typing in 5 or more characters may make the program crash. The correct usage " + "here is 'scanf(\"%4s\", c);', as the maximum field width does not include the " + "terminating null byte.\n" + "Source: http://linux.die.net/man/3/scanf\n" + "Source: http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/libkern/stdio/scanf.c" + ); } //---------------------------------------------------------------------------