diff options
author | Justin Stitt <[email protected]> | 2023-08-09 18:19:32 +0000 |
---|---|---|
committer | Richard Weinberger <[email protected]> | 2023-08-26 22:48:38 +0200 |
commit | 32280e83b555d692e8c7b96563b0ee2037585712 (patch) | |
tree | e1523b18bad4a62b1e12157e6391ac0911e25f8c /lib/memory-notifier-error-inject.c | |
parent | ab7ca2eb63a2168619f7595622fe29967ed0959b (diff) |
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: [email protected]
Suggested-by: Kees Cook <[email protected]>
Signed-off-by: Justin Stitt <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
Diffstat (limited to 'lib/memory-notifier-error-inject.c')
0 files changed, 0 insertions, 0 deletions