Fix FP: tmpnam() expects a valid pointer, an uninitialized array (of conforming size) is fine
This commit is contained in:
parent
e1218cf846
commit
b0c34390cd
|
@ -752,7 +752,7 @@
|
||||||
</arg> <arg nr="3"><valid>0,2:36</valid></arg>
|
</arg> <arg nr="3"><valid>0,2:36</valid></arg>
|
||||||
</function>
|
</function>
|
||||||
<function name="time"> <noreturn>false</noreturn> <leak-ignore/> </function>
|
<function name="time"> <noreturn>false</noreturn> <leak-ignore/> </function>
|
||||||
<function name="tmpnam"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-uninit/></arg></function>
|
<function name="tmpnam"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"></arg></function>
|
||||||
<function name="tmpfile"> <noreturn>false</noreturn> </function>
|
<function name="tmpfile"> <noreturn>false</noreturn> </function>
|
||||||
<function name="tolower"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
|
<function name="tolower"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
|
||||||
<function name="toupper"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
|
<function name="toupper"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
|
||||||
|
|
|
@ -3800,6 +3800,17 @@ private:
|
||||||
" mbstowcs (wbuf, str, 3);\n"
|
" mbstowcs (wbuf, str, 3);\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar("void foo() {\n"
|
||||||
|
" char buf[10];\n"
|
||||||
|
" tmpnam(buf);\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
checkUninitVar("void foo() {\n"
|
||||||
|
" char *ptr;\n"
|
||||||
|
" tmpnam(ptr);\n"
|
||||||
|
"}");
|
||||||
|
TODO_ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: ptr\n", "", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkDeadPointer(const char code[]) {
|
void checkDeadPointer(const char code[]) {
|
||||||
|
|
Loading…
Reference in New Issue