]> www.infradead.org Git - users/jedix/linux-maple.git/commit
replace strncpy with strscpy_pad
authorBaris Can Goral <goralbaris@gmail.com>
Wed, 21 May 2025 16:10:37 +0000 (19:10 +0300)
committerPaolo Abeni <pabeni@redhat.com>
Mon, 26 May 2025 20:28:44 +0000 (22:28 +0200)
commit5bccdc51f90c3194fda4bab92c521c2e2eb4e887
tree4fb65d9e8ea65e80adfc4100f1a36e429f68f6f4
parentf5b60d6a575a7573a15e08aad129382aa39c228c
replace strncpy with strscpy_pad

The strncpy() function is actively dangerous to use since it may not
NULL-terminate the destination string, resulting in potential memory
content exposures, unbounded reads, or crashes.
Link: https://github.com/KSPP/linux/issues/90
In addition, strscpy_pad is more appropriate because it also zero-fills
any remaining space in the destination if the source is shorter than
the provided buffer size.

Signed-off-by: Baris Can Goral <goralbaris@gmail.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Link: https://patch.msgid.link/20250521161036.14489-1-goralbaris@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/rds/connection.c