On Mon, Jun 27, 2022 at 8:32 AM Yangxi Xiang xyangxi5@gmail.com wrote:
a common calling pattern is strncpy_from_user(buf, user_ptr, sizeof(buf)). However a buffer-overflow read occurs in this loop when reading the last byte. Fix it by early checking the available bytes.
Signed-off-by: Yangxi Xiang xyangxi5@gmail.com
This function was removed in commit 98b861a30431 ("asm-generic: uaccess: remove inline strncpy_from_user/strnlen_user"), and the new version in lib/strncpy_from_user.c does not have the problem
On which architecture and kernel version do you see the problem?
Arnd