Bug 7945

Summary: netconfig dumps core if hostname not found (with source fix!)
Product: [Retired] Red Hat Linux Reporter: Stephen J. Friedl <steve>
Component: pumpAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: cmulcahy, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-02-23 21:04:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Stephen J. Friedl 1999-12-22 09:50:33 UTC
pump-0.7.2 contains netconfig (the interactive network setup program),
and when it takes the machine's hostname to do a reverse DNS lookup,
it dumps core if the name is not found.

The problem is in "net.c" near line 464:

    int findHostAndDomain(...)
    {
       ....
    #ifdef __STANDALONE__
       he = gethostbyaddr( (char *)&dev->dev.ip, sizeof....);
       name = he->h_name; /* BUG BUG BUG */
    #else
       name = mygethostbyaddr(inet_ntoa(dev->dev.ip));
    #endif

The bug-marked line dereferences "he" even if it's a NULL, and this
causes a core dump. This line should instead be:

       name = he ? he->h_name : 0;

so that (a) we don't dereference "he" unless it's valid, and
(b) the "name" variable is always initialized with *something*.

Comment 1 Bill Nottingham 1999-12-22 16:51:59 UTC
Fixed in CVS. Will be fixed in next pump release.