diff options
authorPhil Sutter <>2019-11-21 11:59:23 +0100
committerPhil Sutter <>2019-11-21 16:47:36 +0100
commit4e5e23adaad58cded55b55b6c90aa0cbc207feb2 (patch)
parentbf11d72b8adb57a76936cea6ac4db942136d053d (diff)
Eliminate compiler warning about size passed to strncmp()
Gcc complains about the size being equal to destination size, despite the nul character being explicitly set in following line. Reduce size by one to make gcc happy. While being at it, drop the explicit nul character assignment - it is not needed as the buffer was allocated by calloc(). Fixes: 8f586939999e0 ("fix potential buffer overflows reported by static analysis") Acked-by: Phil Sutter <> Acked-by: Pablo Neira Ayuso <>
1 files changed, 1 insertions, 2 deletions
diff --git a/arptables.c b/arptables.c
index 09c9ca2..2b6618c 100644
--- a/arptables.c
+++ b/arptables.c
@@ -2065,8 +2065,7 @@ int do_command(int argc, char *argv[], char **table, arptc_handle_t *handle)
target->t = fw_calloc(1, size);
target->t->u.target_size = size;
- strncpy(target->t->, jumpto, sizeof(target->t->;
- target->t->[sizeof(target->t->] = '\0';
+ strncpy(target->t->, jumpto, sizeof(target->t-> - 1);
target->t->u.user.revision = target->revision;
target->init(target->t, &fw.nfcache);