Fixed false positives related to %*[] in scanf format string (#3468)

This commit is contained in:
PKEuS 2012-01-04 11:22:42 +01:00
parent 0369681a2c
commit eabdc9082e
2 changed files with 2 additions and 1 deletions

View File

@ -1342,7 +1342,7 @@ void CheckOther::checkWrongPrintfScanfArguments()
percent = false; percent = false;
bool _continue = false; bool _continue = false;
while (i != formatString.end() && !std::isalpha(*i)) { while (i != formatString.end() && *i != ']' && !std::isalpha(*i)) {
if (*i == '*') { if (*i == '*') {
if (scan) if (scan)
_continue = true; _continue = true;

View File

@ -2079,6 +2079,7 @@ private:
" scanf(\"%1u%1u\", &foo, bar());\n" " scanf(\"%1u%1u\", &foo, bar());\n"
" scanf(\"%*1x %1x %29s\", &count, KeyName);\n" // #3373 " scanf(\"%*1x %1x %29s\", &count, KeyName);\n" // #3373
" fscanf(f, \"%7ms\", &ref);\n" // #3461 " fscanf(f, \"%7ms\", &ref);\n" // #3461
" sscanf(ip_port, \"%*[^:]:%d\", &port);\n" // #3468
"}"); "}");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());