fix: json_get_cmd 未去除引号导致命令匹配失败

simple_parse_json 提取字符串值时保留双引号, json_get_cmd
直接用于 strcmp 匹配命令表, 因 "pwd_verify" != pwd_verify
导致所有命令都走进 'unsupported command' 分支。
改用 json_get_str_field (自动去引号) 修复。
This commit is contained in:
wangfq
2026-06-30 17:52:30 +08:00
parent eb79c66763
commit ae02e58a36

View File

@@ -85,10 +85,7 @@ static uint32_t json_get_msg_id(const char *json) {
}
static void json_get_cmd(const char *json, char *out, int out_len) {
reset_tmp();
simple_parse_json(json, "\"cmd\"", g_tmp_value);
strncpy(out, g_tmp_value, out_len - 1);
out[out_len - 1] = '\0';
json_get_str_field(json, "\"cmd\"", out, out_len);
}
static char *json_get_data_str(const char *json) {