about summary refs log tree commit diff
path: root/nscd/initgrcache.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/initgrcache.c
parent9ad58cc3ba614e13af5a6f3810f9b115899eb2ca (diff)
downloadglibc-5a337776da5b7ff1dbbf0fdcd093a3b6af2cdf83.tar.gz
glibc-5a337776da5b7ff1dbbf0fdcd093a3b6af2cdf83.tar.xz
glibc-5a337776da5b7ff1dbbf0fdcd093a3b6af2cdf83.zip
* nscd/grpcache.c (cache_addgr): Correctly compute size of cvs/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/initgrcache.c')
-rw-r--r--nscd/initgrcache.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index 3355df5164..c5693c6be5 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -246,7 +246,8 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
   else
     {
 
-      written = total = sizeof (struct dataset) + start * sizeof (int32_t);
+      written = total = (offsetof (struct dataset, strdata)
+			 + start * sizeof (int32_t));
 
       /* If we refill the cache, first assume the reconrd did not
 	 change.  Allocate memory on the cache since it is likely
@@ -307,6 +308,9 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
       /* Finally the user name.  */
       memcpy (cp, key, req->key_len);
 
+      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)