Fix FP with embedded zeros (#4226)
* Partial fix for #11137 FN: invalidFunctionArgStr printf argument * Typo * Remove <strz>, suppressions * Add suppresion, remove <strz> * Add suppressions * Fix FP with embedded zeros * Merge
This commit is contained in:
parent
de2509f1ac
commit
0d4b4394bb
|
@ -174,7 +174,7 @@ void CheckFunctions::invalidFunctionUsage()
|
|||
const Token* strTok = varTok->getValueTokenMinStrSize(mSettings);
|
||||
if (strTok) {
|
||||
const int strSize = Token::getStrArraySize(strTok);
|
||||
if (strSize > count)
|
||||
if (strSize > count && strTok->str().find('\0') == std::string::npos)
|
||||
invalidFunctionArgStrError(argtok, functionToken->str(), argnr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -729,6 +729,12 @@ private:
|
|||
" strcat(dest, if_name);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int f() {\n"
|
||||
" const char c[3] = \"ab\\0\";\n"
|
||||
" return strlen(c);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void mathfunctionCall_sqrt() {
|
||||
|
|
Loading…
Reference in New Issue