Bug 7945 - netconfig dumps core if hostname not found (with source fix!)
Summary: netconfig dumps core if hostname not found (with source fix!)
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: pump
Version: 6.1
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 1999-12-22 09:50 UTC by Stephen J. Friedl
Modified: 2014-03-17 02:11 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2000-02-23 21:04:11 UTC

Attachments (Terms of Use)

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 */
       name = mygethostbyaddr(inet_ntoa(dev->dev.ip));

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.

Note You need to log in before you can comment on or make changes to this bug.