]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
xt_quota2: silence a compiler warning
authorJan Engelhardt <jengelh@inai.de>
Wed, 24 Feb 2021 00:12:28 +0000 (01:12 +0100)
committerJan Engelhardt <jengelh@inai.de>
Wed, 24 Feb 2021 00:12:28 +0000 (01:12 +0100)
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

index f0cf3d47e3b425cbc65d6bc2ed74663e6aafebcf..7837cfdb1520f3fc633069b58ee3baecd3d8b5f7 100644 (file)
@@ -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':