Bug 13628

Summary: inet_aton doesn't check valid addresses well enough
Product: Base System Reporter: xaa <xaa>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-CURRENT   
Hardware: Any   
OS: Any   

Description xaa 1999-09-08 00:00:02 UTC
	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");
Comment 1 Bill Fenner 1999-09-09 05:58:22 UTC
Check out PR misc/10231 and http://www.freebsd.org/~adrian/inet_addr/ .
Do they fix your problems?

  Bill
Comment 2 Bill Fenner freebsd_committer freebsd_triage 1999-09-09 17:18:39 UTC
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...