Obtained from: Philippe M. Chiasson <gozer@cpan.org>,
Geoffrey Young <geoff@modperlcookbook.org>
Submitted by: Aaron Bannert
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@97578
13f79535-47bb-0310-9956-
ffa450edef68
else {
new->local_addr.sin_addr.s_addr = ap_get_virthost_addr(ips, NULL);
}
+ errno = 0; /* clear errno before calling strtol */
port = ap_strtol(ports, &endptr, 10);
- if (errno || (endptr && *endptr) || port < 1 || port > 65535) {
+ if (errno /* some sort of error */
+ || (endptr && *endptr) /* make sure no trailing characters */
+ || port < 1 || port > 65535) /* underflow/overflow */
+ {
return "Missing, invalid, or non-numeric port";
}
new->local_addr.sin_port = htons((unsigned short)port);