]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: silence two compiler warnings
authorFlorian Westphal <fw@strlen.de>
Sun, 17 Jun 2018 20:35:30 +0000 (22:35 +0200)
committerFlorian Westphal <fw@strlen.de>
Sun, 17 Jun 2018 20:41:35 +0000 (22:41 +0200)
inlined from ‘do_commandarp’ at xtables-arp.c:1198:16:
xtables-arp.c:844:2: warning: ‘strncpy’ specified bound 29 equals destination size [-Wstringop-truncation]
  strncpy(target->t->u.user.name, jumpto, sizeof(target->t->u.user.name));
xtables-eb-translate.c: In function ‘do_commandeb_xlate’:
xtables-eb-translate.c:285:6: warning: unused variable ‘chcounter’ [-Wunused-variable]
  int chcounter = 0; /* Needed for -C */
      ^~~~~~~~~
Signed-off-by: Florian Westphal <fw@strlen.de>
iptables/xtables-arp.c
iptables/xtables-eb-translate.c

index 4a968f4b9763faaf7940b07b7dee7b77e8691248..c4cda7e0cf318da2a71bdce36527235e10a217a2 100644 (file)
@@ -841,7 +841,7 @@ static struct xtables_target *command_jump(struct arpt_entry *fw,
 
        target->t = xtables_calloc(1, size);
        target->t->u.target_size = size;
-       strncpy(target->t->u.user.name, jumpto, sizeof(target->t->u.user.name));
+       strncpy(target->t->u.user.name, jumpto, sizeof(target->t->u.user.name) - 1);
        target->t->u.user.name[sizeof(target->t->u.user.name)-1] = '\0';
        target->t->u.user.revision = target->revision;
 
index 9ae1127eae813f9dd8904dc3a4b488185fa09bee..42b88e35595b06a6928db0bc12d0219400e97059 100644 (file)
@@ -282,7 +282,6 @@ static int do_commandeb_xlate(struct nft_handle *h, int argc, char *argv[], char
 {
        char *buffer;
        int c, i;
-       int chcounter = 0; /* Needed for -C */
        int rule_nr = 0;
        int rule_nr_end = 0;
        int ret = 0;