diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-08-19 21:03:12 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-08-19 21:03:12 +0000 |
commit | 8583671dd4d0fb367f41963739c814838a2025e3 (patch) | |
tree | 5415a750df326c7eb5f5aaf64c0ed555fb76b739 | |
parent | 10b71c3d31c7a4fe437fdda6b5730479414e935a (diff) | |
download | glibc-8583671dd4d0fb367f41963739c814838a2025e3.tar glibc-8583671dd4d0fb367f41963739c814838a2025e3.tar.gz glibc-8583671dd4d0fb367f41963739c814838a2025e3.tar.bz2 glibc-8583671dd4d0fb367f41963739c814838a2025e3.zip |
Update.
2004-08-19 Ulrich Drepper <drepper@redhat.com>
* nis/nss_compat/compat-initgroups.c (getgrent_next_nss):
Initialize mysize with limits only if latter is >= 0. Use mysize
in malloc call.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | nis/nss_compat/compat-initgroups.c | 6 |
2 files changed, 9 insertions, 3 deletions
@@ -1,3 +1,9 @@ +2004-08-19 Ulrich Drepper <drepper@redhat.com> + + * nis/nss_compat/compat-initgroups.c (getgrent_next_nss): + Initialize mysize with limits only if latter is >= 0. Use mysize + in malloc call. + 2004-08-19 Jakub Jelinek <jakub@redhat.com> * sysdeps/posix/getaddrinfo.c (gaih_inet): Cast canon to (char *) diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c index 7f14481395..cea561ddc4 100644 --- a/nis/nss_compat/compat-initgroups.c +++ b/nis/nss_compat/compat-initgroups.c @@ -242,8 +242,8 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user, if (nss_initgroups_dyn && nss_getgrgid_r) { long int mystart = 0; - long int mysize = limit; - gid_t *mygroupsp = malloc (limit * sizeof (gid_t)); + long int mysize = limit <= 0 ? *size : limit; + gid_t *mygroupsp = malloc (mysize * sizeof (gid_t)); if (mygroupsp == NULL) return NSS_STATUS_TRYAGAIN; @@ -258,7 +258,7 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user, if (nss_initgroups_dyn (user, group, &mystart, &mysize, &mygroupsp, limit, errnop) == NSS_STATUS_SUCCESS) { - /* A temporary buffer. We use the normal buffer, until we found + /* A temporary buffer. We use the normal buffer, until we find an entry, for which this buffer is to small. In this case, we overwrite the pointer with one to a bigger buffer. */ char *tmpbuf = buffer; |