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:
@@ -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) {
|
static void json_get_cmd(const char *json, char *out, int out_len) {
|
||||||
reset_tmp();
|
json_get_str_field(json, "\"cmd\"", out, out_len);
|
||||||
simple_parse_json(json, "\"cmd\"", g_tmp_value);
|
|
||||||
strncpy(out, g_tmp_value, out_len - 1);
|
|
||||||
out[out_len - 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *json_get_data_str(const char *json) {
|
static char *json_get_data_str(const char *json) {
|
||||||
|
|||||||
Reference in New Issue
Block a user