Skip to content

Commit 3b4aff6

Browse files
tobluxummakynes
authored andcommitted
netfilter: xtables: Use strscpy() instead of strscpy_pad()
kzalloc() already zero-initializes the destination buffer, making strscpy() sufficient for safely copying the name. The additional NUL- padding performed by strscpy_pad() is unnecessary. The size parameter is optional, and strscpy() automatically determines the size of the destination buffer using sizeof() if the argument is omitted. This makes the explicit sizeof() call unnecessary; remove it. No functional changes intended. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 778b09d commit 3b4aff6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/netfilter/xt_repldata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
if (tbl == NULL) \
3030
return NULL; \
3131
term = (struct type##_error *)&(((char *)tbl)[term_offset]); \
32-
strscpy_pad(tbl->repl.name, info->name, sizeof(tbl->repl.name)); \
32+
strscpy(tbl->repl.name, info->name); \
3333
*term = (struct type##_error)typ2##_ERROR_INIT; \
3434
tbl->repl.valid_hooks = hook_mask; \
3535
tbl->repl.num_entries = nhooks + 1; \

0 commit comments

Comments
 (0)