[dm-devel] [PATCH 16/35] libmultipath: fix gcc -Wstringop-overflow warning

mwilck at suse.com mwilck at suse.com
Thu Jul 9 10:16:01 UTC 2020


From: Martin Wilck <mwilck at suse.com>

This fixes this gcc error message:

error: ‘strncat’ specified bound 1 equals source length
   [-Werror=stringop-overflow=]
Signed-off-by: Martin Wilck <mwilck at suse.com>
---
 libmultipath/parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libmultipath/parser.c b/libmultipath/parser.c
index 11a6168..4f65ba1 100644
--- a/libmultipath/parser.c
+++ b/libmultipath/parser.c
@@ -374,7 +374,7 @@ set_value(vector strvec)
 			goto oom;
 		}
 		if (*alloc != '\0')
-			strncat(alloc, " ", 1);
+			strncat(alloc, " ", len - strlen(alloc));
 		strncat(alloc, str, len - strlen(alloc) - 1);
 	}
 	return alloc;
-- 
2.26.2





More information about the dm-devel mailing list