Bug 81413 - getXXbyYY functions to not realloc buffer and re-call getXXbyYY_r
getXXbyYY functions to not realloc buffer and re-call getXXbyYY_r
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
7.3
i586 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-01-09 01:29 EST by Matt Peterson
Modified: 2016-11-24 10:24 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-01-20 12:31:42 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Matt Peterson 2003-01-09 01:29:29 EST
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 11:40:40 EST
Incidentally, this problem is most obvious when group entries (with lots of  group members) exceed 1024 bytes  
Comment 2 Jakub Jelinek 2003-01-20 12:31:42 EST
This was fixed on 2002-09-11.

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