Justin Stitt 5c80c4fced isdn: replace deprecated strncpy with strscpy
`strncpy` is deprecated for use on NUL-terminated destination strings
[1] and as such we should prefer more robust and less ambiguous string
interfaces.

We expect `iclock->name` to be NUL-terminated based on its use within
printk:
|	printk(KERN_DEBUG "%s: %s %d\n", __func__, iclock->name,
|	       iclock->pri);

`iclock` is zero-initialized and as such is already NUL-padded which
means strncpy is doing extra work here by eagerly NUL-padding the
destination buffer.

Considering the above, a suitable replacement is `strscpy` [2] due to
the fact that it guarantees NUL-termination on the destination buffer
without unnecessarily NUL-padding.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2]
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230922-strncpy-drivers-isdn-misdn-clock-c-v1-1-3ba2a5ae627a@google.com
Signed-off-by: Kees Cook <keescook@chromium.org>
2023-10-02 11:07:02 -07:00
..
2023-08-22 15:50:57 +02:00
Hi,
2023-09-13 11:44:20 -07:00
2023-09-04 13:47:59 -07:00
2023-08-24 16:20:30 -07:00
2023-09-03 10:49:42 -07:00
2023-08-30 13:34:34 -07:00
2023-09-04 11:26:29 -07:00
2023-08-28 16:35:01 -07:00
2023-09-01 09:53:54 -07:00
2023-09-02 12:02:41 -07:00
2023-09-06 09:24:25 -07:00
2023-09-01 16:54:25 -07:00
2023-09-04 13:52:58 -07:00
2023-08-31 12:43:10 -07:00
2023-08-29 09:47:33 -07:00
2023-09-01 09:38:00 -07:00
2023-09-04 13:47:59 -07:00
2023-08-30 18:32:24 -07:00
2023-09-14 16:20:31 -06:00
2023-08-30 16:59:03 -07:00
2023-08-18 10:55:49 +05:30
2023-09-09 11:35:28 -07:00
2023-09-08 12:48:37 -07:00
2023-09-03 10:38:02 -07:00
2023-09-07 18:05:58 -07:00
2023-09-07 15:51:07 -07:00
2023-09-04 15:12:26 -07:00
2023-09-04 15:08:52 -07:00
2023-09-07 16:07:35 -07:00
2023-09-08 21:39:54 -07:00
2023-09-03 10:20:57 -07:00
2023-09-07 15:49:20 -07:00
2023-09-01 09:38:00 -07:00
2023-09-04 10:43:44 -07:00
2023-08-30 20:41:37 -07:00
2023-09-06 09:00:37 -07:00
2023-08-24 16:20:18 -07:00
2023-09-06 09:19:12 -07:00
2023-08-29 20:32:10 -07:00
2023-08-21 13:27:44 +02:00