Red Hat Bugzilla – Bug 81413
getXXbyYY functions to not realloc buffer and re-call getXXbyYY_r
Last modified: 2016-11-24 10:24:00 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
Version-Release number of selected component (if applicable):
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.
Incidentally, this problem is most obvious when group entries (with lots of group members) exceed 1024 bytes
This was fixed on 2002-09-11.