Eric Sesterhenn: Fixed #1130 (False positive uninitialized variable)
This commit is contained in:
parent
b4b63789fc
commit
11da89784f
|
@ -1399,7 +1399,8 @@ private:
|
|||
}
|
||||
|
||||
// reading 2nd parameter..
|
||||
if (Token::Match(&tok, "strcpy|strncpy ( %any% , %var%"))
|
||||
if (Token::Match(&tok, "strcpy ( %any% , %var% ) ") ||
|
||||
Token::Match(&tok, "strncpy ( %any% , %var% ,"))
|
||||
{
|
||||
use_array(foundError, checks, tok.tokAt(4));
|
||||
}
|
||||
|
|
|
@ -1286,6 +1286,14 @@ private:
|
|||
" int x = a;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar("void f(struct blame_entry *ent)\n"
|
||||
"{\n"
|
||||
" struct origin *suspect = ent->suspect;\n"
|
||||
" char hex[41];\n"
|
||||
" strcpy(hex, sha1_to_hex(suspect->commit->object.sha1));\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue