Commit 06f7d3c3 authored by Justin Stitt's avatar Justin Stitt Committed by Florian Westphal

netfilter: x_tables: refactor deprecated strncpy

Prefer `strscpy_pad` to `strncpy`.
Signed-off-by: default avatarJustin Stitt <justinstitt@google.com>
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
parent ad156c23
...@@ -768,7 +768,7 @@ void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr, ...@@ -768,7 +768,7 @@ void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
m->u.user.match_size = msize; m->u.user.match_size = msize;
strscpy(name, match->name, sizeof(name)); strscpy(name, match->name, sizeof(name));
module_put(match->me); module_put(match->me);
strncpy(m->u.user.name, name, sizeof(m->u.user.name)); strscpy_pad(m->u.user.name, name, sizeof(m->u.user.name));
*size += off; *size += off;
*dstptr += msize; *dstptr += msize;
...@@ -1148,7 +1148,7 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr, ...@@ -1148,7 +1148,7 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
t->u.user.target_size = tsize; t->u.user.target_size = tsize;
strscpy(name, target->name, sizeof(name)); strscpy(name, target->name, sizeof(name));
module_put(target->me); module_put(target->me);
strncpy(t->u.user.name, name, sizeof(t->u.user.name)); strscpy_pad(t->u.user.name, name, sizeof(t->u.user.name));
*size += off; *size += off;
*dstptr += tsize; *dstptr += tsize;
...@@ -2014,4 +2014,3 @@ static void __exit xt_fini(void) ...@@ -2014,4 +2014,3 @@ static void __exit xt_fini(void)
module_init(xt_init); module_init(xt_init);
module_exit(xt_fini); module_exit(xt_fini);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment