pacparser.c (pacparser-1.3.9) | : | pacparser.c (pacparser-1.4.0) | ||
---|---|---|---|---|
skipping to change at line 445 | skipping to change at line 445 | |||
print_error("%s %s\n", error_prefix, | print_error("%s %s\n", error_prefix, | |||
"Javascript function findProxyForURL not defined."); | "Javascript function findProxyForURL not defined."); | |||
return NULL; | return NULL; | |||
} | } | |||
// URL-encode "'" as we use single quotes to stick the URL into a temporary sc ript. | // URL-encode "'" as we use single quotes to stick the URL into a temporary sc ript. | |||
char *sanitized_url = str_replace(url, "'", "%27"); | char *sanitized_url = str_replace(url, "'", "%27"); | |||
// Hostname shouldn't have single quotes in them | // Hostname shouldn't have single quotes in them | |||
if (strchr(host, '\'')) { | if (strchr(host, '\'')) { | |||
print_error("%s %s\n", error_prefix, | print_error("%s %s\n", error_prefix, | |||
"Invalid hostname: hostname can't have single quotes."); | "Invalid hostname: hostname can't have single quotes."); | |||
return NULL; | return NULL; | |||
} | } | |||
script = (char*) malloc(32 + strlen(url) + strlen(host)); | script = (char*) malloc(32 + strlen(sanitized_url) + strlen(host)); | |||
script[0] = '\0'; | script[0] = '\0'; | |||
strcat(script, "findProxyForURL('"); | strcat(script, "findProxyForURL('"); | |||
strcat(script, sanitized_url); | strcat(script, sanitized_url); | |||
strcat(script, "', '"); | strcat(script, "', '"); | |||
strcat(script, host); | strcat(script, host); | |||
strcat(script, "')"); | strcat(script, "')"); | |||
if (_debug()) print_error("DEBUG: Executing JavaScript: %s\n", script); | if (_debug()) print_error("DEBUG: Executing JavaScript: %s\n", script); | |||
if (!JS_EvaluateScript(cx, global, script, strlen(script), NULL, 1, &rval)) { | if (!JS_EvaluateScript(cx, global, script, strlen(script), NULL, 1, &rval)) { | |||
print_error("%s %s\n", error_prefix, "Problem in executing findProxyForURL." ); | print_error("%s %s\n", error_prefix, "Problem in executing findProxyForURL." ); | |||
free(sanitized_url); | free(sanitized_url); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |