snprintf/g_snprintf: do not allow uninitialized target buffer

This commit is contained in:
Daniel Marjamäki 2018-12-22 20:40:47 +01:00
parent cc4a9e2790
commit e6e3987935
3 changed files with 18 additions and 2 deletions

View File

@ -2438,8 +2438,23 @@
<noreturn>false</noreturn>
</function>
<function name="g_snprintf">
<leak-ignore/>
<returnValue type="int"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
<not-uninit/>
<minsize type="argvalue" arg="2"/>
</arg>
<arg nr="2">
<not-uninit/>
<valid>0:</valid>
</arg>
<formatstr/>
<arg nr="3">
<formatstr/>
<not-null/>
<not-uninit/>
</arg>
</function>
<function name="g_source_remove">
<leak-ignore/>

View File

@ -5813,6 +5813,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
<not-uninit/>
<minsize type="argvalue" arg="2"/>
</arg>
<arg nr="2">

View File

@ -3527,7 +3527,7 @@ void uninitvar_snprintf(char *S, size_t N, char *Format, int Int)
(void)snprintf(S,N,format,Int); // format is uninitialized
// cppcheck-suppress uninitvar
(void)snprintf(S,N,Format,i); // i is uninitialized
// TODO cppcheck-suppress uninitvar
// cppcheck-suppress uninitvar
(void)snprintf(s,N,Format,Int);
// no warning is expected for