Bug 140378 (IT_53059) - [RHEL3] glibc behavior with long lines in /etc/hosts
Summary: [RHEL3] glibc behavior with long lines in /etc/hosts
Keywords:
Status: CLOSED ERRATA
Alias: IT_53059
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: glibc
Version: 3.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-11-22 17:44 UTC by David Lehman
Modified: 2007-11-30 22:07 UTC (History)
4 users (show)

Fixed In Version: RHBA-2005-096
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-05-18 13:59:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
hosts file demonstrating line length limitation (23.46 KB, text/plain)
2004-11-22 17:44 UTC, David Lehman
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2005:096 0 normal SHIPPED_LIVE glibc bug fix update 2005-06-09 04:00:00 UTC
Red Hat Product Errata RHSA-2005:256 0 high SHIPPED_LIVE Low: glibc security update 2005-05-18 04:00:00 UTC
Sourceware 768 0 None None None 2019-06-19 15:00:52 UTC

Description David Lehman 2004-11-22 17:44:38 UTC
Description of problem:
glibc is failing to parse extremely long lines in /etc/hosts, which may or may
not be okay, depending on the intended behavior. However, the limitation is not
as simple as line length. Also, name resolution fails for any entries in
/etc/hosts which appear after/below the too-long entry.

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

How reproducible:
Always

Steps to Reproduce:
1. Copy the the attached hosts file to /etc/hosts
2. Use 'getent hosts' to retrieve testhost5 and testhost6 info
3. 
  
Actual results:
testhost5 is found, but testhost6 (which is after the too-long line) is not

Expected results:
both testhost5 and testhost6 found by getent

Additional info:
'getent ahosts' works for testhost6 even when 'getent hosts' does not

Comment 1 David Lehman 2004-11-22 17:44:38 UTC
Created attachment 107203 [details]
hosts file demonstrating line length limitation

Comment 5 David Lehman 2004-11-29 20:06:38 UTC
I rebuilt glibc-2.3.2-95.27 with the patch from the above libc-hacker
post and it seems to solve the problem completely for me. When might
this appear in an RHEL3 update/errata?


Comment 6 Jakub Jelinek 2004-11-29 21:45:54 UTC
It should appear in RHEL3 U5.

Comment 7 Jakub Jelinek 2004-11-30 10:44:11 UTC
This is fixed for RHEL4 in glibc-2.3.3-86 (and for Fedora Core will be RSN),
so just RHEL3 remains.

Comment 8 Frank Hirtz 2004-12-09 19:53:31 UTC
This works great. There is one remaining question as nscd still will
fail on sufficiently long lines (though with this fix, those after it
will still work). Do we know what that limitation is (or is supposed
to be)?

Comment 9 Jakub Jelinek 2004-12-23 21:20:16 UTC
Fix added to glibc-2.3.2-95.31, for the time being available from
ftp://people.redhat.com/jakub/glibc/2.3.2-95.31/


Comment 10 Frank Hirtz 2005-01-03 20:44:47 UTC
From the client who originally posted the issue, there is still the
one remaining question on the allowable length of a line in /etc/hosts
when nscd is in use. They're looking to understand the limitation so
that they can pass guidelines to their admin groups. 

Comment 11 Roland McGrath 2005-02-17 21:53:57 UTC
There is no fixed limit.  The code will dynamically allocate a buffer as needed
to contain whatever data there is.  The bug was in the logic that noticed that
the original buffer was too small and allocated a larger buffer to retry the read.
With the glibc fix, it should resize the buffer correctly and have no limit but
available memory.  Note that applications need to be written to handle the case
of unusually large data, by recognizing the ERANGE error from get*_r and calling
it again with a larger buffer.

Comment 13 Jakub Jelinek 2005-02-21 21:48:29 UTC
Indeed, this is a glibc bug.
See http://sources.redhat.com/ml/libc-hacker/2005-02/msg00054.html
for a fix.  The RHEL3 backport of that patch is similar, but not identical.

Comment 17 Jakub Jelinek 2005-02-23 14:58:11 UTC
A fixed RHEL3 glibc candidate at ftp://people.redhat.com/jakub/glibc/2.3.2-95.33/

Comment 18 Tim Powers 2005-05-18 13:59:58 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2005-256.html



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