Blob Blame History Raw
From d3724c422da83279eb7550019668c29bbf16592a Mon Sep 17 00:00:00 2001
From: Florian Westphal <fw@strlen.de>
Date: Wed, 6 Jun 2018 14:21:57 +0200
Subject: [PATCH] extensions: fix build failure on fc28
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

make fails via:
extensions/ebt_string.c: In function ‘parse’:
extensions/ebt_string.c:171:3: error: ‘strncpy’ specified bound 16 equals destination size [-Werror=stringop-truncation]
   strncpy(info->algo, optarg, XT_STRING_MAX_ALGO_NAME_SIZE);

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Phil Sutter <psutter@redhat.com>
---
 extensions/ebt_string.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/extensions/ebt_string.c b/extensions/ebt_string.c
index 9550c41096a86..3deff1ba83264 100644
--- a/extensions/ebt_string.c
+++ b/extensions/ebt_string.c
@@ -168,7 +168,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
 		ebt_check_option2(flags, OPT_STRING_ALGO);
 		if (ebt_check_inverse2(optarg))
 			ebt_print_error2("Unexpected `!' after --string-algo");
-		strncpy(info->algo, optarg, XT_STRING_MAX_ALGO_NAME_SIZE);
+		snprintf(info->algo, sizeof(info->algo), "%s", optarg);
 		break;
 	case STRING_ICASE:
 		ebt_check_option2(flags, OPT_STRING_ICASE);
-- 
2.21.0