Fixed false positives related to %*[] in scanf format string (#3468)
This commit is contained in:
parent
0369681a2c
commit
eabdc9082e
|
@ -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;
|
||||||
|
|
|
@ -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());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue