[klibc] [klibc:master] Suppress format truncation warnings for sprintf() and vsprintf()

klibc-bot for Ben Hutchings ben at decadent.org.uk
Sat Mar 28 15:36:01 PDT 2020


Commit-ID:  d8e32d95a1bff2639f9ede9eae9b07b53f37bdac
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=d8e32d95a1bff2639f9ede9eae9b07b53f37bdac
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Sat, 28 Mar 2020 21:57:26 +0000
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 28 Mar 2020 21:57:26 +0000

[klibc] Suppress format truncation warnings for sprintf() and vsprintf()

These functions pass a huge maximum size to the corresponding
length-limiting functions.  gcc warns about this and suggests that
we should pass INT_MAX at most.  I don't think this is correct, so
suppress the warnings.

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/klibc/Kbuild | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild
index 19ccfbec..24bad07d 100644
--- a/usr/klibc/Kbuild
+++ b/usr/klibc/Kbuild
@@ -83,6 +83,11 @@ ifeq ($(CONFIG_KLIBC_ERRLIST),y)
 KLIBCCFLAGS_strerror.o += -DWITH_ERRLIST
 endif
 
+# These pass a huge maximum length to the corresponding length-limiting
+# functions
+KLIBCCFLAGS_sprintf.o += -Wno-format-truncation
+KLIBCCFLAGS_vsprintf.o += -Wno-format-truncation
+
 # sigsuspend.c includes <klibc/havesyscall.h> generated by syscalls/
 # build, so require that to build first
 $(obj)/sigsuspend.o: $(obj)/syscalls/klib.list


More information about the klibc mailing list