Whamcloud - gitweb
LU-17400 uapi: Fix incorrect snamelen return value 24/53624/5
authorJosh Samuelson <josh@1up.unl.edu>
Mon, 8 Jan 2024 19:03:52 +0000 (13:03 -0600)
committerOleg Drokin <green@whamcloud.com>
Sun, 4 Feb 2024 08:31:02 +0000 (08:31 +0000)
commitb8f4a96b5ebd5cd35747b0a061277d02d46e7a4c
treefecb5e3a04f8e71c227cb78aa94cdcd31d5bc741
parent6826fe0efefc03e22ad723104866b15b59fa68ed
LU-17400 uapi: Fix incorrect snamelen return value

The sname char array is limited by the struct
changelog_rec.cr_namelen value and has no '\0' character allocated
to it, so strlen() will overrun the char array till it finds the next
'\0' char.

This issue can be seen on the client side when "lfs changelog"
is run and 08RENME record types are present.

Pointer arithmetic was used between sname and name to avoid the
GCC 11 warnings mentioned in 6331eadbd6.

Added Andreas's safety/range check code to changelog_rec_sname.

Fixes: 6331eadbd6 ("LU-15420 uapi: avoid gcc-11 -Werror=stringop-overread")
Signed-off-by: Josh Samuelson <josh@1up.unl.edu>
Change-Id: Ie0817dfdd1d02e06b9399e66f1affaadb9e156c4
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53624
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: xinliang <xinliang.liu@linaro.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/tests/sanity.sh