From: Martin Wilck <[email protected]>

Allow the compiler to catch possible format string overflows.
Two were found by gcc 10.

Signed-off-by: Martin Wilck <[email protected]>
---
 Makefile.inc             | 2 +-
 libmultipath/discovery.c | 2 +-
 libmultipath/print.c     | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile.inc b/Makefile.inc
index f1e2313..8a7a648 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -97,7 +97,7 @@ ERROR_DISCARDED_QUALIFIERS := $(call 
TEST_CC_OPTION,-Werror=discarded-qualifiers
 WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)
 
 OPTFLAGS       := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4
-WARNFLAGS      := -Werror -Wall -Wextra -Wformat=2 -Werror=implicit-int \
+WARNFLAGS      := -Werror -Wall -Wextra -Wformat=2 -Wformat-overflow=2 
-Werror=implicit-int \
                  -Werror=implicit-function-declaration -Werror=format-security 
\
                  $(WNOCLOBBERED) -Werror=cast-qual 
$(ERROR_DISCARDED_QUALIFIERS)
 CPPFLAGS       := -Wp,-D_FORTIFY_SOURCE=2 
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index ec99a7a..bfe2f56 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -635,7 +635,7 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
 {
        struct udev_device *rport_dev = NULL;
        char value[16], *eptr;
-       char rport_id[32];
+       char rport_id[42];
        unsigned int tmo;
        int ret;
 
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 8151e11..3c69bf4 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -1,4 +1,4 @@
-/*
+ /*
  * Copyright (c) 2005 Christophe Varoqui
  */
 #include <stdio.h>
@@ -594,7 +594,7 @@ int
 snprint_tgt_wwpn (char * buff, size_t len, const struct path * pp)
 {
        struct udev_device *rport_dev = NULL;
-       char rport_id[32];
+       char rport_id[42];
        const char *value = NULL;
        int ret;
 
-- 
2.31.1


--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to