Bug 474800

Summary: call to _nss_nis_gethostbyname4_r() segfaults for hostnames without domain suffix
Product: [Fedora] Fedora Reporter: Christoph Karle <karle>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 10CC: drepper, jakub
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-12-10 04:37:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Christoph Karle 2008-12-05 13:07:16 UTC
Description of problem:
Call to _nss_nis_gethostbyname4_r() in nis/nss_nis/nis-hosts.c segfaults for host names without domain suffix, e.g. "somehost" instead of "somehost.somedomain.com".
The actual offender is line 490
int parse_res = parse_line (result, &host, &data, buflen, errnop, AF_UNSPEC, 0);
which returns host (of type struct hostent) empty, so that
in line 528
size_t h_name_len = strlen (host.h_name);
segfaults, because host.h_name is a null pointer

Version-Release number of selected component (if applicable):
glibc 2.9.2

How reproducible:
always
$ ssh <hostname>

Steps to Reproduce:
1.
/etc/nsswitch.conf
...
hosts:      files nis dns
...
2.
$ ssh <hostname>
where <hostname> lacks a domain suffix and needs to be resolved over nis,
i.e. is not found in /etc/hosts

Actual results:
Segmentation fault


Expected results:
the result should be the same as for
$ ssh <hostname.domainname>
i.e. no segfault

Comment 1 Ulrich Drepper 2008-12-07 10:01:28 UTC
A patch I checked into the glibc upstream cvs should fix the problem.

Comment 2 Jakub Jelinek 2008-12-08 14:47:37 UTC
Please try glibc-2.9-3 http://kojipkgs.fedoraproject.org/packages/glibc/2.9/3/.

Comment 3 Christoph Karle 2008-12-08 15:14:01 UTC
(In reply to comment #2)
> Please try glibc-2.9-3 http://kojipkgs.fedoraproject.org/packages/glibc/2.9/3/.

Works again, Thanks to both of you.

Comment 4 Fedora Update System 2008-12-08 20:34:51 UTC
glibc-2.9-3 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/glibc-2.9-3

Comment 5 Fedora Update System 2008-12-10 04:36:52 UTC
glibc-2.9-3 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.