netfilter: xtables: Use strscpy() instead of strscpy_pad()
Subsystems (3)
PATCH 1/1 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.
--- net/netfilter/xt_repldata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/xt_repldata.h +1 -1
@@ -29,7 +29,7 @@if (tbl ==NULL ) \return NULL ; \ term = (struct type##_error *)&(((char *)tbl)[term_offset]); \ -strscpy_pad (tbl->repl.name, info->name,sizeof (tbl->repl.name)); \ +strscpy (tbl->repl.name, info->name); \ *term = (struct type##_error)typ2##_ERROR_INIT; \ tbl->repl.valid_hooks = hook_mask; \ tbl->repl.num_entries = nhooks +1 ; \
Quoted 11 lines · Thorsten Blum
kzalloc()already zero-initializes the destination buffer, makingstrscpy()sufficient for safely copying the name. The additional NUL- padding performed bystrscpy_pad()is unnecessary.The size parameter is optional, and
strscpy()automatically determines the size of the destination buffer usingsizeof()if the argument is omitted. This makes the explicitsizeof()call unnecessary; remove it.No functional changes intended.
Signed-off-by Thorsten Blum <[email protected]>