Bug 474800 - call to _nss_nis_gethostbyname4_r() segfaults for hostnames without domain suffix
call to _nss_nis_gethostbyname4_r() segfaults for hostnames without domain su...
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
i686 Linux
low Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-12-05 08:07 EST by Christoph Karle
Modified: 2008-12-09 23:37 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-12-09 23:37:08 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Christoph Karle 2008-12-05 08:07:16 EST
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:
$ ssh <hostname>

Steps to Reproduce:
hosts:      files nis dns
$ 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 05:01:28 EST
A patch I checked into the glibc upstream cvs should fix the problem.
Comment 2 Jakub Jelinek 2008-12-08 09:47:37 EST
Please try glibc-2.9-3 http://kojipkgs.fedoraproject.org/packages/glibc/2.9/3/.
Comment 3 Christoph Karle 2008-12-08 10:14:01 EST
(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 15:34:51 EST
glibc-2.9-3 has been submitted as an update for Fedora 10.
Comment 5 Fedora Update System 2008-12-09 23:36:52 EST
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.

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