diff options
author | Florian Westphal <fw@strlen.de> | 2018-05-20 23:56:32 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2018-05-20 23:56:32 +0200 |
commit | 14ec9984811a1c5d39010ebbd3ff171fd8f51652 (patch) | |
tree | 28d6bbb4cecfc43388aaf2ae25323da613902b65 /iptables/xtables-eb-translate.c | |
parent | 5e2b473a64bc772a5fb08d121fbfd969ca652bec (diff) |
xtables-compat: ebtables: prefer snprintf to strncpy
gcc emits these warnings:
xtables-eb-translate.c:185:2: warning: ‘strncpy’ specified bound 29 equals destination size [-Wstringop-truncation]
strncpy(target->t->u.user.name, jumpto, sizeof(target->t->u.user.name));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/xtables-eb-translate.c')
-rw-r--r-- | iptables/xtables-eb-translate.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/iptables/xtables-eb-translate.c b/iptables/xtables-eb-translate.c index e54415a2..d274151a 100644 --- a/iptables/xtables-eb-translate.c +++ b/iptables/xtables-eb-translate.c @@ -182,7 +182,8 @@ static struct xtables_target *command_jump(struct iptables_command_state *cs, 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)); + snprintf(target->t->u.user.name, + sizeof(target->t->u.user.name), "%s", jumpto); target->t->u.user.name[sizeof(target->t->u.user.name)-1] = '\0'; target->t->u.user.revision = target->revision; |