[core] fix leak in http request parser
This commit is contained in:
parent
22ae5a1ba1
commit
8e4b418ee4
|
@ -4176,11 +4176,12 @@ SWITCH_DECLARE(void) switch_http_parse_qs(switch_http_request_t *request, char *
|
||||||
char *q;
|
char *q;
|
||||||
char *next;
|
char *next;
|
||||||
char *name, *val;
|
char *name, *val;
|
||||||
|
char *dup = NULL;
|
||||||
|
|
||||||
if (qs) {
|
if (qs) {
|
||||||
q = qs;
|
q = qs;
|
||||||
} else { /*parse our own qs, dup to avoid modify the original string */
|
} else { /*parse our own qs, dup to avoid modify the original string */
|
||||||
q = strdup(request->qs);
|
dup = q = strdup(request->qs);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_assert(q);
|
switch_assert(q);
|
||||||
|
@ -4207,9 +4208,7 @@ SWITCH_DECLARE(void) switch_http_parse_qs(switch_http_request_t *request, char *
|
||||||
q = next;
|
q = next;
|
||||||
} while (q);
|
} while (q);
|
||||||
|
|
||||||
if (!qs) {
|
switch_safe_free(dup);
|
||||||
switch_safe_free(q);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clean the uri to protect us from vulnerability attack */
|
/* clean the uri to protect us from vulnerability attack */
|
||||||
|
|
Loading…
Reference in New Issue