kernel: refactor CMD_GET_FULL_VERSION to safely initialize version string (#220)

Use strscpy()/strlcpy() to populate the version buffer in CMD_GET_FULL_VERSION
instead of relying on uninitialized memory. This ensures the returned string
is null-terminated and avoids exposing garbage data to user space.

Signed-off-by: schqiushui <orochi9999@gmail.com>
This commit is contained in:
古塵
2025-06-27 00:23:12 +08:00
committed by ShirkNeko
parent 8e192aaead
commit d0cb0cf25a
3 changed files with 37 additions and 32 deletions

View File

@@ -4,7 +4,7 @@
#include <linux/types.h>
#include <linux/workqueue.h>
#define KERNEL_SU_VERSION KSU_API_VERSION
#define KERNEL_SU_VERSION KSU_VERSION
#define KERNEL_SU_OPTION 0xDEADBEEF
#define CMD_GRANT_ROOT 0
@@ -40,11 +40,11 @@
#define KSU_MAX_GROUPS 32
#define KSU_SELINUX_DOMAIN 64
#define KSU_MAX_VERSION_NAME 255
#ifndef KSU_VERSION
#define KSU_VERSION "v0-unknown-00000000@unkown"
// SukiSU Ultra kernel su version full strings
#ifndef KSU_VERSION_FULL
#define KSU_VERSION_FULL "v3.x-00000000@unknown"
#endif
#define KSU_FULL_VERSION_STRING 255
// SUSFS Functional State Structures
struct susfs_feature_status {