diff options
author | Kees Cook <[email protected]> | 2023-11-30 12:41:00 -0800 |
---|---|---|
committer | Martin K. Petersen <[email protected]> | 2023-12-05 21:01:52 -0500 |
commit | 0d224b1088afef95f7069b7ca907cb199a5802ff (patch) | |
tree | 4e5283f3677fde2b5398d69127b4e47e52c5b048 /scripts/generate_rust_analyzer.py | |
parent | 28c58f8a0947f70ddee275b90fe45431146bb2cc (diff) |
scsi: zfcp: Replace strlcpy() with strscpy()
strlcpy() reads the entire source buffer first. This read may exceed the
destination size limit. This is both inefficient and can lead to linear
read overflows if a source string is not NUL-terminated[1]. Additionally,
it returns the size of the source string, not the resulting size of the
destination string. In an effort to remove strlcpy() completely[2], replace
strlcpy() here with strscpy().
Overflow should be impossible here, but actually check for buffer sizes
being identical with BUILD_BUG_ON(), and include a run-time check as well.
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [1]
Link: https://github.com/KSPP/linux/issues/89 [2]
Cc: Martin K. Petersen <[email protected]>
Cc: James E.J. Bottomley <[email protected]>
Cc: Steffen Maier <[email protected]>
Cc: Benjamin Block <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Vasily Gorbik <[email protected]>
Cc: Alexander Gordeev <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Sven Schnelle <[email protected]>
Cc: Azeem Shaikh <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Acked-by: Benjamin Block <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions