Skip to content

Commit

Permalink
mi_script: fix infinite loop where there are multiple params
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Sep 9, 2022
1 parent f988e15 commit 34ce451
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/mi_script/mi_script.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,11 @@ static mi_request_t *mi_script_parse_request(str *method, str *params,
trim_leading(params);
p = q_memchr(params->s, ' ', params->len);
avp_val.s = *params;
if (p)
if (p) {
avp_val.s.len = p - avp_val.s.s;
params->s += avp_val.s.len;
params->len -= avp_val.s.len;
}
if (avp_val.s.len <= 0)
break;
val = cJSON_CreateStr(avp_val.s.s, avp_val.s.len);
Expand Down

0 comments on commit 34ce451

Please sign in to comment.