Skip to content

Commit 040e58f

Browse files
committed
std.cfg: strxfrm(): Added minize values to arg1 and arg2 and a TODO test case
1 parent cf21161 commit 040e58f

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

cfg/std.cfg

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5088,10 +5088,15 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
50885088
<noreturn>false</noreturn>
50895089
<leak-ignore/>
50905090
<!-- In case the 3rd argument is 0, the 1st argument is permitted to be a null pointer. (#6306) -->
5091-
<arg nr="1" direction="out"/>
5091+
<arg nr="1" direction="out">
5092+
<strz/>
5093+
<minsize type="argvalue" arg="3"/>
5094+
</arg>
50925095
<arg nr="2" direction="in">
50935096
<not-null/>
50945097
<not-uninit/>
5098+
<strz/>
5099+
<minsize type="argvalue" arg="3"/>
50955100
</arg>
50965101
<arg nr="3" direction="in">
50975102
<not-uninit/>

test/cfg/std.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3550,6 +3550,17 @@ void uninitvar_strxfrm(void)
35503550
(void)strxfrm(ds,ss,n);
35513551
}
35523552

3553+
void bufferAccessOutOfBounds_strxfrm(void)
3554+
{
3555+
const char src[3] = "abc";
3556+
char dest[1] = "a";
3557+
(void)strxfrm(dest,src,1);
3558+
// TODO cppcheck-suppress bufferAccessOutOfBounds
3559+
(void)strxfrm(dest,src,2);
3560+
// TODO cppcheck-suppress bufferAccessOutOfBounds
3561+
(void)strxfrm(dest,src,3);
3562+
}
3563+
35533564
void uninitvar_wcsxfrm(void)
35543565
{
35553566
wchar_t *ds;

0 commit comments

Comments
 (0)