Skip to content

Commit

Permalink
sys: Fix issue with /proc UI visibility
Browse files Browse the repository at this point in the history
When started using heap for filename, missed to
replace sizeof() from copy_from_user, therefore
it was copying up to 8 bytes only.
  • Loading branch information
JNE committed Dec 21, 2024
1 parent fcad9ef commit e2e4093
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down

0 comments on commit e2e4093

Please sign in to comment.