From 6ad5a94acf7ba11d93556f96c2691b1073b328ad Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Sun, 1 May 2022 18:10:19 +0200 Subject: [PATCH] gnu.cfg: Improved configuration for memrchr(). --- cfg/gnu.cfg | 1 + test/cfg/gnu.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cfg/gnu.cfg b/cfg/gnu.cfg index 7cb66e5ce..5124a8cc8 100644 --- a/cfg/gnu.cfg +++ b/cfg/gnu.cfg @@ -1127,6 +1127,7 @@ + diff --git a/test/cfg/gnu.c b/test/cfg/gnu.c index 545ef8cad..5e19805f4 100644 --- a/test/cfg/gnu.c +++ b/test/cfg/gnu.c @@ -21,9 +21,17 @@ #ifndef __CYGWIN__ #include #endif - #include +void *bufferAccessOutOfBounds_memrchr(const void *s, int c, size_t n) +{ + char buf[42]={0}; + (void)memrchr(buf,c,42); + // cppcheck-suppress bufferAccessOutOfBounds + (void)memrchr(buf,c,43); + return memrchr(s,c,n); +} + void knownConditionTrueFalse_ffsl(long i) { // ffs() returns the position of the first bit set, or 0 if no bits are set in i.