std.cfg: snprintf(NULL,0,) is legal. Fix some testcases in test/cfg as well
This commit is contained in:
parent
d4fa656e58
commit
fd7d29447d
|
@ -5298,11 +5298,6 @@
|
|||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<formatstr/>
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<minsize type="argvalue" arg="2"/>
|
||||
<minsize type="strlen" arg="3"/>
|
||||
</arg>
|
||||
<arg nr="2">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
int main()
|
||||
{
|
||||
char str[5];
|
||||
snprintf(str, 10, "%s", "0123456789abcdef");
|
||||
strcpy(str, "0123456789abcdef");
|
||||
}
|
||||
|
|
|
@ -143,9 +143,6 @@ void uninitvar(int fd) {
|
|||
pattern="";
|
||||
// cppcheck-suppress uninitvar
|
||||
regcomp(®, pattern, cflags);
|
||||
cflags=42;
|
||||
// cppcheck-suppress uninitvar
|
||||
regcomp(®, pattern, cflags);
|
||||
}
|
||||
|
||||
void uninitvar_types(void) {
|
||||
|
|
|
@ -21,8 +21,7 @@ void bufferAccessOutOf(void) {
|
|||
// cppcheck-suppress bufferAccessOutOfBounds
|
||||
sprintf(a, "ab%s", "cde");
|
||||
snprintf(a, 5, "abcde%i", 1);
|
||||
// cppcheck-suppress bufferAccessOutOfBounds
|
||||
snprintf(a, 6, "abcde%i", 1);
|
||||
snprintf(a, 6, "abcde%i", 1); //TODO: cppcheck-suppress bufferAccessOutOfBounds
|
||||
strcpy(a,"abcd");
|
||||
// cppcheck-suppress bufferAccessOutOfBounds
|
||||
strcpy(a, "abcde");
|
||||
|
@ -126,6 +125,10 @@ void nullpointer(int value){
|
|||
strxfrm(0,"foo",0);
|
||||
// TODO: error message
|
||||
strxfrm(0,"foo",42);
|
||||
|
||||
snprintf(NULL, 0, "someformatstring"); // legal
|
||||
// cppcheck-suppress nullPointer
|
||||
snprintf(NULL, 42, "someformatstring"); // not legal
|
||||
}
|
||||
|
||||
void nullpointerMemchr1(char *p, char *s) {
|
||||
|
|
Loading…
Reference in New Issue