Skip to content

Commit 2f08a1c

Browse files
committed
escape url in json output, fixes google#259
1 parent d95877a commit 2f08a1c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ios_webkit_debug_proxy.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,8 @@ char *iwdp_ipages_to_text(iwdp_ipage_t *ipages, bool want_json,
18321832
ipage->title ? ipage->title : "");
18331833
char* escaped_app_id = iwdp_escape_json_string_val(
18341834
ipage->app_id ? ipage->app_id : "");
1835+
char* escaped_page_url = iwdp_escape_json_string_val(
1836+
ipage->url ? ipage->url : "");
18351837

18361838
int res = asprintf(&s,
18371839
"%s{\n"
@@ -1844,11 +1846,12 @@ char *iwdp_ipages_to_text(iwdp_ipage_t *ipages, bool want_json,
18441846
" \"appId\": \"%s\"\n"
18451847
"}",
18461848
(sum_len ? "," : ""), (href && !ipage->iws ? href : ""),
1847-
(ipage->url ? ipage->url : ""), escaped_title, (ipage->url ? ipage->url : ""),
1849+
escaped_page_url, escaped_title, escaped_page_url,
18481850
(host ? host : "localhost"), port, ipage->page_num, escaped_app_id);
18491851

18501852
free(escaped_title);
18511853
free(escaped_app_id);
1854+
free(escaped_page_url);
18521855

18531856
if (res < 0) {
18541857
free(href);

0 commit comments

Comments
 (0)