Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 81413 - getXXbyYY functions to not realloc buffer and re-call getXXbyYY_r
Summary: getXXbyYY functions to not realloc buffer and re-call getXXbyYY_r
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 7.3
Hardware: i586
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-01-09 06:29 UTC by Matt Peterson
Modified: 2016-11-24 15:24 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-01-20 17:31:42 UTC


Attachments (Terms of Use)

Description Matt Peterson 2003-01-09 06:29:29 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003

Description of problem:
When called with too small a buffer nss modules are supposed to return
NSS_STATUS_TRYAGAIN as per comment on line 217 of nss/getXXbyYY_r.c.  The
reentrant function maps this state to a return code of EAGAIN.

The realloc loop in the non-reentrant function (line 124 of nss/getXXbyYY.c)
expects ERANGE which can not possibly be returned from the function.  The result
is that getpwnam and friends will not work when used with passwd or group
entries that exceed the initial buffer size of 1024 bytes

# rpm -qa | grep glibc

glibc-2.2.93-5
glibc-common-2.2.93-5
glibc-devel-2.2.93-5
glibc-kernheaders-2.4-7.20



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


How reproducible:
Always

Steps to Reproduce:
1.create a password entry with a very long GECOS field such that the entire
entry is > 1024 bytes
2.write a simple program that calls getpwnam for this user
3.You'll notice that instead of re-allocating memory getpwnam and calling again,
the getpwnam implementation returns with errno=34.
    

Additional info:

Comment 1 Matt Peterson 2003-01-09 16:40:40 UTC
Incidentally, this problem is most obvious when group entries (with lots of  group members) exceed 1024 bytes  

Comment 2 Jakub Jelinek 2003-01-20 17:31:42 UTC
This was fixed on 2002-09-11.


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