PAC helper called with the wrong number of arguments
high
A built-in PAC helper is called with too few or too many arguments. Missing arguments are undefined, which makes the helper return false or an unexpected value for every host.
Why it matters
The helpers are plain JavaScript functions, so a wrong argument count is not an error at
call time. isInNet(host, "10.0.0.0") compares against an undefined mask,
dnsDomainIs(host) compares against undefined, and shExpMatch(host, "a", "b") ignores
the third argument. In every case the branch is silently wrong rather than loudly broken.
How to fix
Check the helper signature (isInNet needs host, network, mask; dnsDomainIs and shExpMatch need host and pattern).
Examples
Bad
function FindProxyForURL(url, host) {
if (isInNet(host, "10.0.0.0")) {
return "DIRECT";
}
return "PROXY proxy.corp.example:8080";
}
Open bad example in checkerGood
function FindProxyForURL(url, host) {
if (isInNet(host, "10.0.0.0", "255.0.0.0")) {
return "DIRECT";
}
return "PROXY proxy.corp.example:8080";
}
Open good example in checkerRelated rules
- isInNet called with an invalid address, mask or argument count PAC-E010
- isInNet arguments in the wrong order PAC-C016