From 088ac1f99ebb69bfa64178179368b768fb67177a Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 12 Jun 2026 13:55:18 +0200 Subject: [PATCH 1/4] Update std.cfg --- cfg/std.cfg | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index ec5fbb72548..ce1298ec7ab 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -4056,7 +4056,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun false - + arg1 @@ -4077,7 +4077,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun false - + arg1 @@ -4118,7 +4118,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + arg1 false @@ -4136,7 +4136,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + arg1 false @@ -4812,7 +4812,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + arg1 false @@ -4828,9 +4828,9 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + - + arg1 false @@ -4942,7 +4942,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + arg1 false @@ -5057,7 +5057,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + arg1 false @@ -5123,10 +5123,10 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + false - + arg1 @@ -5373,7 +5373,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + arg1 false From 9c985b321d123973da1f263dd7874e43cd48ef52 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 12 Jun 2026 14:02:50 +0200 Subject: [PATCH 2/4] Update std.cpp --- test/cfg/std.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 0344b98455c..7bee5c279d4 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -4982,6 +4982,18 @@ std::span returnDanglingLifetime_std_span1() { } #endif +void* returnDanglingLifetime_memcpy() { // #14833 + char a[4]; + // cppcheck-suppress returnDanglingLifetime + return memcpy(a, "abc", 4); +} + +wchar_t* returnDanglingLifetime_wcscat() { + wchar_t a[10]{L"abc"}; + // cppcheck-suppress returnDanglingLifetime + return wcscat(a, L"def"); +} + void beginEnd() { std::vector v; From 9b7f3c42b2e8d840f17c09d15e20cf4373bdcaab Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 12 Jun 2026 14:25:46 +0200 Subject: [PATCH 3/4] Update std.cpp [skip ci] --- test/cfg/std.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 7bee5c279d4..77c9d99cd5d 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -869,7 +869,7 @@ char * overlappingWriteFunction_strncat(const char *src, char *dest, const std:: // cppcheck-suppress overlappingWriteFunction (void)strncat(dest, dest+1, 2); char buffer[] = "strncat"; - // cppcheck-suppress overlappingWriteFunction + // cppcheck-suppress [overlappingWriteFunction,returnDanglingLifetime] return strncat(buffer, buffer + 1, 3); } @@ -882,7 +882,7 @@ wchar_t * overlappingWriteFunction_wcsncat(const wchar_t *src, wchar_t *dest, co // cppcheck-suppress overlappingWriteFunction (void)wcsncat(dest, dest+1, 2); wchar_t buffer[] = L"strncat"; - // cppcheck-suppress overlappingWriteFunction + // cppcheck-suppress [overlappingWriteFunction,returnDanglingLifetime] return wcsncat(buffer, buffer + 1, 3); } @@ -917,8 +917,8 @@ char * overlappingWriteFunction_strncpy(char *buf, const std::size_t count) void * overlappingWriteFunction_memmove(void) { - // No warning shall be shown: char str[] = "memmove handles overlapping data well"; + // cppcheck-suppress returnDanglingLifetime return memmove(str,str+3,4); } From 953836dd4283592762b440dc7dc69f58fa7d4071 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 12 Jun 2026 14:27:19 +0200 Subject: [PATCH 4/4] Update std.cfg --- cfg/std.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index ce1298ec7ab..245142c091d 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -3989,7 +3989,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + arg1 false @@ -4010,7 +4010,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + arg1 false