gfs2: Switch from strlcpy to strscpy
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 26 Aug 2022 13:12:17 +0000 (15:12 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Fri, 26 Aug 2022 13:27:06 +0000 (15:27 +0200)
commit204c0300c4e99707e9fb6e57840aa1127060e63f
tree0586579e9613a61fb2a1aa3976ce4f0a90f44cd8
parent86934198eefa10a71f35162b06c44c36d85b98ba
gfs2: Switch from strlcpy to strscpy

Switch from strlcpy to strscpy and make sure that @count is the size of
the smaller of the source and destination buffers.  This prevents
reading beyond the end of the source buffer when the source string isn't
null terminated.

Found by a modified version of syzkaller.

Suggested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/ops_fstype.c