| Summary: | inet_aton doesn't check valid addresses well enough | ||
|---|---|---|---|
| Product: | Base System | Reporter: | xaa <xaa> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 4.0-CURRENT | ||
| Hardware: | Any | ||
| OS: | Any | ||
Check out PR misc/10231 and http://www.freebsd.org/~adrian/inet_addr/ . Do they fix your problems? Bill State Changed From-To: open->closed misc/10231 reports the same problem; Adrian's solution addresses Mark's problem. Now we just have to get the fix into the tree... |
inet_aton should return 0 on invalid IP addresses. 1000.0.0.0 is an invalid address but inet_aton will kindly return 1000*(1<<24) and 1 for a successful translation Fix: check the parts more carefully. haven't checked linux' code yet, but that correctly returns a 0 for invalid addresses How-To-Repeat: if (!inet_aton("1000.0.0.0",&sockaddress)) { fprintf(stderr,"invalid address\n"); } else fprintf(stderr,"valid address??\n");