summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-core/safec/safec/0001-strpbrk_s-Remove-unused-variable-len.patch42
-rw-r--r--meta-oe/recipes-core/safec/safec/0001-vsnprintf_s-Increase-Buffer-Size-by-1.patch41
-rw-r--r--meta-oe/recipes-core/safec/safec_3.9.1.bb (renamed from meta-oe/recipes-core/safec/safec_3.7.1.bb)8
3 files changed, 45 insertions, 46 deletions
diff --git a/meta-oe/recipes-core/safec/safec/0001-strpbrk_s-Remove-unused-variable-len.patch b/meta-oe/recipes-core/safec/safec/0001-strpbrk_s-Remove-unused-variable-len.patch
deleted file mode 100644
index 4fd36ab8ab..0000000000
--- a/meta-oe/recipes-core/safec/safec/0001-strpbrk_s-Remove-unused-variable-len.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From b1d7cc6495c541cdd99399b4d1a835997376dcbf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 22 Aug 2022 23:42:33 -0700
4Subject: [PATCH] strpbrk_s: Remove unused variable len
5
6Fixes
7error: variable 'len' set but not used [-Werror,-Wunused-but-set-variable]
8
9Upstream-Status: Submitted [https://github.com/rurban/safeclib/pull/123]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 src/extstr/strpbrk_s.c | 3 ---
13 1 file changed, 3 deletions(-)
14
15diff --git a/src/extstr/strpbrk_s.c b/src/extstr/strpbrk_s.c
16index 5bb7a0f8..2cf8a8be 100644
17--- a/src/extstr/strpbrk_s.c
18+++ b/src/extstr/strpbrk_s.c
19@@ -79,7 +79,6 @@ EXPORT errno_t _strpbrk_s_chk(char *dest, rsize_t dmax, char *src, rsize_t slen,
20 #endif
21 {
22 char *ps;
23- rsize_t len;
24
25 CHK_SRC_NULL("strpbrk_s", firstp)
26 *firstp = NULL;
27@@ -121,7 +120,6 @@ EXPORT errno_t _strpbrk_s_chk(char *dest, rsize_t dmax, char *src, rsize_t slen,
28 while (*dest && dmax) {
29
30 ps = src;
31- len = slen;
32 while (*ps) {
33
34 /* check for a match with the substring */
35@@ -130,7 +128,6 @@ EXPORT errno_t _strpbrk_s_chk(char *dest, rsize_t dmax, char *src, rsize_t slen,
36 return RCNEGATE(EOK);
37 }
38 ps++;
39- len--;
40 }
41 dest++;
42 dmax--;
diff --git a/meta-oe/recipes-core/safec/safec/0001-vsnprintf_s-Increase-Buffer-Size-by-1.patch b/meta-oe/recipes-core/safec/safec/0001-vsnprintf_s-Increase-Buffer-Size-by-1.patch
new file mode 100644
index 0000000000..5617aeb368
--- /dev/null
+++ b/meta-oe/recipes-core/safec/safec/0001-vsnprintf_s-Increase-Buffer-Size-by-1.patch
@@ -0,0 +1,41 @@
1From dca9a17c75c7442060c08fdced4e4b0c8d2babae Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 13 Aug 2025 20:23:48 -0700
4Subject: [PATCH] vsnprintf_s: Increase Buffer Size by 1
5
6It is a buffer overflow warning that GCC 15.2 is catching.
7The issue is that it's trying to write to `buf[len++]` when len could
8potentially be 31, which would write to buf[31] in a buffer of size 32
9(valid indices 0-31), but the len++ post-increment means it could
10theoretically write beyond the buffer bounds.
11
12Fixes
13
14../../sources/safec-3.9.1/src/str/vsnprintf_s.c: In function 'safec_ftoa.isra':
15../../sources/safec-3.9.1/src/str/vsnprintf_s.c:523:24: error: writing 32 bytes into a region of size 31 [-Werror=stringop-overflow=]
16 523 | buf[len++] = '0';
17 | ~~~~~~~~~~~^~~~~
18../../sources/safec-3.9.1/src/str/vsnprintf_s.c:394:10: note: at offset [1, 32] into destination object 'buf' of size 32
19 394 | char buf[PRINTF_FTOA_BUFFER_SIZE];
20 | ^~~
21cc1: all warnings being treated as errors
22
23Upstream-Status: Submitted [https://github.com/rurban/safeclib/pull/148]
24Signed-off-by: Khem Raj <raj.khem@gmail.com>
25---
26 src/str/vsnprintf_s.c | 2 +-
27 1 file changed, 1 insertion(+), 1 deletion(-)
28
29diff --git a/src/str/vsnprintf_s.c b/src/str/vsnprintf_s.c
30index fa53ab42..0b62c3cb 100644
31--- a/src/str/vsnprintf_s.c
32+++ b/src/str/vsnprintf_s.c
33@@ -391,7 +391,7 @@ static size_t safec_ftoa(out_fct_type out, const char *funcname, char *buffer,
34 size_t idx, size_t maxlen, double value,
35 unsigned int prec, unsigned int width,
36 unsigned int flags) {
37- char buf[PRINTF_FTOA_BUFFER_SIZE];
38+ char buf[PRINTF_FTOA_BUFFER_SIZE + 1]; // Add extra byte for safety
39 size_t len = 0U, off = 0U;
40 double tmp;
41 double diff = 0.0;
diff --git a/meta-oe/recipes-core/safec/safec_3.7.1.bb b/meta-oe/recipes-core/safec/safec_3.9.1.bb
index 4de58f5d63..3635476d1c 100644
--- a/meta-oe/recipes-core/safec/safec_3.7.1.bb
+++ b/meta-oe/recipes-core/safec/safec_3.9.1.bb
@@ -6,10 +6,10 @@ SECTION = "lib"
6 6
7inherit autotools pkgconfig 7inherit autotools pkgconfig
8 8
9SRCREV = "f9add9245b97c7bda6e28cceb0ee37fb7e254fd8" 9SRCREV = "39a0a819f80853498e48a6e601a446a122b64aaa"
10SRC_URI = "git://github.com/rurban/safeclib.git;branch=master;protocol=https \ 10SRC_URI = "git://github.com/rurban/safeclib.git;branch=master;protocol=https;tag=v${PV} \
11 file://0001-strpbrk_s-Remove-unused-variable-len.patch \ 11 file://0001-vsnprintf_s-Increase-Buffer-Size-by-1.patch \
12 " 12 "
13# arm-yoe-linux-gnueabi-clang: error: argument unused during compilation: '-mretpoline' [-Werror,-Wunused-command-line-argument] 13# arm-yoe-linux-gnueabi-clang: error: argument unused during compilation: '-mretpoline' [-Werror,-Wunused-command-line-argument]
14# arm-yoe-linux-gnueabi-clang: error: argument unused during compilation: '-fstack-clash-protection' [-Werror,-Wunused-command-line-argument] 14# arm-yoe-linux-gnueabi-clang: error: argument unused during compilation: '-fstack-clash-protection' [-Werror,-Wunused-command-line-argument]
15TUNE_CCARGS:append:toolchain-clang = " -Qunused-arguments" 15TUNE_CCARGS:append:toolchain-clang = " -Qunused-arguments"