diff options
author | Justin Stitt <justinstitt@google.com> | 2023-08-09 18:19:32 +0000 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2023-08-16 13:52:19 -0700 |
commit | be8dffa04de3894bad0bf31d1531a2f06353b70e (patch) | |
tree | 47a9c2766b77ab024b99a76ed42863d86d26fcc1 /include/linux/compiler_attributes.h | |
parent | 30bed99e0c6335b711119b9fda806da7b4031dfb (diff) | |
download | linux-be8dffa04de3894bad0bf31d1531a2f06353b70e.tar.gz linux-be8dffa04de3894bad0bf31d1531a2f06353b70e.tar.bz2 linux-be8dffa04de3894bad0bf31d1531a2f06353b70e.zip |
um: refactor deprecated strncpy to memcpy
Use `memcpy` since `console_buf` is not expected to be NUL-terminated
and it more accurately describes what is happening with the buffers
`console_buf` and `string` as per Kees' analysis [1].
Also mark char buffer as `__nonstring` as per Kees' suggestion [2].
This change now makes it more clear what this code does and that
`console_buf` is not expected to be NUL-terminated.
Link: https://lore.kernel.org/all/202308081708.D5ADC80F@keescook/ [1]
Link: https://github.com/KSPP/linux/issues/90 [2]
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
Cc: linux-hardening@vger.kernel.org
Suggested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20230809-arch-um-v3-1-f63e1122d77e@google.com
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'include/linux/compiler_attributes.h')
0 files changed, 0 insertions, 0 deletions