docs: networking: Replace strncpy() with strscpy()

Replace example code's use of strncpy() with strscpy() functions. Using
strncpy() is considered deprecated:
https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://lore.kernel.org/r/20210602202914.4079123-1-keescook@chromium.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
Kees Cook
2021-06-02 13:29:14 -07:00
committed by Jonathan Corbet
parent 709dedfdf3
commit f9ce26c56d
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -263,7 +263,7 @@ possible overrun should the name be too long::
char name[128];
if (ioctl(fd, JSIOCGNAME(sizeof(name)), name) < 0)
strncpy(name, "Unknown", sizeof(name));
strscpy(name, "Unknown", sizeof(name));
printf("Name: %s\n", name);