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