fix: V-001 security vulnerability

Automated security fix generated by Orbis Security AI
This commit is contained in:
orbisai0security 2026-05-12 16:10:28 +00:00
parent 34e9246e4a
commit a7a7f2f106

View file

@ -33,7 +33,7 @@ void get_layout_abbr(char *abbr, const char *full_name) {
// 1. 尝试在映射表中查找 // 1. 尝试在映射表中查找
for (int32_t i = 0; layout_mappings[i].full_name != NULL; i++) { for (int32_t i = 0; layout_mappings[i].full_name != NULL; i++) {
if (strcmp(full_name, layout_mappings[i].full_name) == 0) { if (strcmp(full_name, layout_mappings[i].full_name) == 0) {
strcpy(abbr, layout_mappings[i].abbr); snprintf(abbr, 32, "%s", layout_mappings[i].abbr);
return; return;
} }
} }
@ -73,7 +73,7 @@ void get_layout_abbr(char *abbr, const char *full_name) {
abbr[2] = '\0'; abbr[2] = '\0';
} else { } else {
// 5. 最终回退:返回 "xx" // 5. 最终回退:返回 "xx"
strcpy(abbr, "xx"); snprintf(abbr, 32, "xx");
} }
} }