aboutsummaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-09-05 23:34:47 +0000
committerUlrich Drepper <drepper@redhat.com>1999-09-05 23:34:47 +0000
commitbd952512eac147864ad25e8bcca5c5094b0d958a (patch)
tree7fdfd8e40cefa6c0797ab5893950c315a4ac7e4b /nscd
parent5bb17dca42994797eff18bfe9707072dd9543bc7 (diff)
downloadglibc-bd952512eac147864ad25e8bcca5c5094b0d958a.zip
glibc-bd952512eac147864ad25e8bcca5c5094b0d958a.tar.gz
glibc-bd952512eac147864ad25e8bcca5c5094b0d958a.tar.bz2
Update.
1999-08-31 H.J. Lu <hjl@gnu.org> * nscd/nscd_getgr_r.c (nscd_getgr_r): Cleanup the buffer count.
Diffstat (limited to 'nscd')
-rw-r--r--nscd/nscd_getgr_r.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/nscd/nscd_getgr_r.c b/nscd/nscd_getgr_r.c
index eb71705..aa9c3fd 100644
--- a/nscd/nscd_getgr_r.c
+++ b/nscd/nscd_getgr_r.c
@@ -147,19 +147,20 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
align the pointer. */
align = ((__alignof__ (char *) - (p - ((char *) 0)))
& (__alignof__ (char *) - 1));
- if (buflen < (align + (1 + gr_resp.gr_mem_cnt) * sizeof (char *)
- + gr_resp.gr_name_len + gr_resp.gr_passwd_len))
+ total_len = align + (1 + gr_resp.gr_mem_cnt) * sizeof (char *)
+ + gr_resp.gr_name_len + gr_resp.gr_passwd_len;
+ if (buflen < total_len)
{
no_room:
__set_errno (ERANGE);
__close (sock);
return ERANGE;
}
+ buflen -= total_len;
p += align;
resultbuf->gr_mem = (char **) p;
p += (1 + gr_resp.gr_mem_cnt) * sizeof (char *);
- buflen -= align + (1 + gr_resp.gr_mem_cnt) * sizeof (char *);
/* Set pointers for strings. */
resultbuf->gr_name = p;
@@ -180,8 +181,6 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
vec[1].iov_len = gr_resp.gr_name_len + gr_resp.gr_passwd_len;
total_len += gr_resp.gr_name_len + gr_resp.gr_passwd_len;
- buflen -= gr_resp.gr_name_len + gr_resp.gr_passwd_len;
-
/* Get this data. */
if (__readv (sock, vec, 2) != total_len)
{