Skip to content

Commit 6ad5a94

Browse files
committed
gnu.cfg: Improved configuration for memrchr().
1 parent 6f6ddb9 commit 6ad5a94

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

cfg/gnu.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,7 @@
11271127
<arg nr="1" direction="in">
11281128
<not-null/>
11291129
<not-uninit/>
1130+
<minsize type="argvalue" arg="3"/>
11301131
</arg>
11311132
<arg nr="2" direction="in">
11321133
<not-uninit/>

test/cfg/gnu.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,17 @@
2121
#ifndef __CYGWIN__
2222
#include <sys/epoll.h>
2323
#endif
24-
2524
#include <strings.h>
2625

26+
void *bufferAccessOutOfBounds_memrchr(const void *s, int c, size_t n)
27+
{
28+
char buf[42]={0};
29+
(void)memrchr(buf,c,42);
30+
// cppcheck-suppress bufferAccessOutOfBounds
31+
(void)memrchr(buf,c,43);
32+
return memrchr(s,c,n);
33+
}
34+
2735
void knownConditionTrueFalse_ffsl(long i)
2836
{
2937
// ffs() returns the position of the first bit set, or 0 if no bits are set in i.

0 commit comments

Comments
 (0)