From 97808473f953b0ed5caa88356386fe7b71db8cea Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Wed, 24 Feb 2021 01:12:28 +0100 Subject: [PATCH] xt_quota2: silence a compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit libxt_quota2.c:73:3: warning: ‘strncpy’ specified bound 15 equals destination size [-Wstringop-truncation] 73 | strncpy(info->name, optarg, sizeof(info->name)); --- extensions/libxt_quota2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/libxt_quota2.c b/extensions/libxt_quota2.c index f0cf3d4..7837cfd 100644 --- a/extensions/libxt_quota2.c +++ b/extensions/libxt_quota2.c @@ -70,7 +70,7 @@ quota_mt2_parse(int c, char **argv, int invert, unsigned int *flags, /* zero termination done on behalf of the kernel module */ xtables_param_act(XTF_ONLY_ONCE, "quota", "--name", *flags & FL_NAME); xtables_param_act(XTF_NO_INVERT, "quota", "--name", invert); - strncpy(info->name, optarg, sizeof(info->name)); + snprintf(info->name, sizeof(info->name), "%s", optarg); *flags |= FL_NAME; return true; case 'p': -- 2.47.2