std.cfg: Added more tests

This commit is contained in:
orbitcowboy 2022-04-22 08:00:45 +02:00
parent 051512dd48
commit 0560a946a8
3 changed files with 43 additions and 0 deletions

View File

@ -5126,6 +5126,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<returnValue type="size_t"/>
<noreturn>false</noreturn>
<leak-ignore/>
<not-overlapping-data ptr1-arg="1" ptr2-arg="2" size-arg="3"/>
<!-- In case the 3rd argument is 0, the 1st argument is permitted to be a null pointer. (#6306) -->
<arg nr="1" direction="out"/>
<arg nr="2" direction="in">

View File

@ -381,6 +381,24 @@ void nullpointer(int value)
wscanf(L"%i", NULL);
}
int nullPointer_wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n)
{
// cppcheck-suppress nullPointer
(void) wcsncmp(NULL,s2,n);
// cppcheck-suppress nullPointer
(void) wcsncmp(s1,NULL,n);
return wcsncmp(s1,s2,n);
}
wchar_t* nullPointer_wcsncpy(wchar_t *s, const wchar_t *cs, size_t n)
{
// cppcheck-suppress nullPointer
(void) wcsncpy(NULL,cs,n);
// cppcheck-suppress nullPointer
(void) wcsncpy(s,NULL,n);
return wcsncpy(s,cs,n);
}
size_t nullPointer_strlen(const char *s)
{
// cppcheck-suppress nullPointer

View File

@ -110,6 +110,12 @@ void overlappingWriteFunction_wcscat(wchar_t *src, wchar_t *dest)
(void)wcscat(src, src);
}
void overlappingWriteFunction_wcsxfrm(wchar_t *s1, wchar_t *s2, size_t n)
{
// No warning shall be shown:
(void)wcsxfrm(s1, s2, n);
}
char * overlappingWriteFunction_strcat(char *src, char *dest)
{
// No warning shall be shown:
@ -118,6 +124,24 @@ char * overlappingWriteFunction_strcat(char *src, char *dest)
return strcat(src, src);
}
int nullPointer_wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n)
{
// cppcheck-suppress nullPointer
(void) std::wcsncmp(NULL,s2,n);
// cppcheck-suppress nullPointer
(void) std::wcsncmp(s1,NULL,n);
return std::wcsncmp(s1,s2,n);
}
wchar_t* nullPointer_wcsncpy(wchar_t *s, const wchar_t *cs, size_t n)
{
// cppcheck-suppress nullPointer
(void) std::wcsncpy(NULL,cs,n);
// cppcheck-suppress nullPointer
(void) std::wcsncpy(s,NULL,n);
return std::wcsncpy(s,cs,n);
}
char * overlappingWriteFunction_strncat(char *src, char *dest, const std::size_t count)
{
// No warning shall be shown: