aboutsummaryrefslogtreecommitdiff
path: root/nscd/grpcache.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-06-12 16:16:38 +0000
committerUlrich Drepper <drepper@redhat.com>2008-06-12 16:16:38 +0000
commit5a337776da5b7ff1dbbf0fdcd093a3b6af2cdf83 (patch)
tree90b83fdd99ba1c9c676a9bf2165732faccf0a088 /nscd/grpcache.c
parent9ad58cc3ba614e13af5a6f3810f9b115899eb2ca (diff)
downloadglibc-5a337776da5b7ff1dbbf0fdcd093a3b6af2cdf83.tar
glibc-5a337776da5b7ff1dbbf0fdcd093a3b6af2cdf83.tar.gz
glibc-5a337776da5b7ff1dbbf0fdcd093a3b6af2cdf83.tar.bz2
glibc-5a337776da5b7ff1dbbf0fdcd093a3b6af2cdf83.zip
* nscd/grpcache.c (cache_addgr): Correctly compute size ofcvs/fedora-glibc-20080612T1619
fixed-size portion of the record. * nscd/servicescache.c (cache_addserv): Likewise. * nscd/pwdcache.c (cache_addpw): Likewise. * nscd/initgrcache.c (addinitgroupsX): Likewise.
Diffstat (limited to 'nscd/grpcache.c')
-rw-r--r--nscd/grpcache.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index e391dc3984..c49c0e1906 100644
--- a/nscd/grpcache.c
+++ b/nscd/grpcache.c
@@ -190,7 +190,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
gr_mem_len_total += gr_mem_len[gr_mem_cnt];
}
- written = total = (sizeof (struct dataset)
+ written = total = (offsetof (struct dataset, strdata)
+ gr_mem_cnt * sizeof (uint32_t)
+ gr_name_len + gr_passwd_len + gr_mem_len_total);
@@ -252,6 +252,9 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
char *key_copy = cp + key_offset;
assert (key_copy == (char *) rawmemchr (cp, '\0') + 1);
+ assert (cp == dataset->strdata + total - offsetof (struct dataset,
+ strdata));
+
/* Now we can determine whether on refill we have to create a new
record or not. */
if (he != NULL)