diff options
author | Anders Johansson <ajohansson@novell.com> | 2009-10-29 22:18:26 -0700 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2009-10-29 22:18:26 -0700 |
commit | ea547a1a6e350b758fcda76b919b3aa774752318 (patch) | |
tree | d78a3f57c05349de4f423eb36cef97f08f83bc77 /nscd/grpcache.c | |
parent | 5c53736b52d5032171813d813d4a7ad505102b61 (diff) | |
download | glibc-ea547a1a6e350b758fcda76b919b3aa774752318.tar.gz glibc-ea547a1a6e350b758fcda76b919b3aa774752318.tar.xz glibc-ea547a1a6e350b758fcda76b919b3aa774752318.zip |
Fix a few asserts and IO calls in nscd.
The nscd/*cache.c files contain assert()s, writeall() and sendfileall() calls that invalidly use together &dataset->resp and total where either dataset or dataset->head.recsize should be used instead one of the components. In the writeall() and sendfileall() cases, it is unlikely to matter in practice, but the assertions can fail sometimes without a proper reason.
Diffstat (limited to 'nscd/grpcache.c')
-rw-r--r-- | nscd/grpcache.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/nscd/grpcache.c b/nscd/grpcache.c index 184d53898c..bd101c675d 100644 --- a/nscd/grpcache.c +++ b/nscd/grpcache.c @@ -295,14 +295,14 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, { assert (db->wr_fd != -1); assert ((char *) &dataset->resp > (char *) db->data); - assert ((char *) &dataset->resp - (char *) db->head + assert ((char *) dataset - (char *) db->head + total <= (sizeof (struct database_pers_head) + db->head->module * sizeof (ref_t) + db->head->data_size)); written = sendfileall (fd, db->wr_fd, (char *) &dataset->resp - - (char *) db->head, total); + - (char *) db->head, dataset->head.recsize); # ifndef __ASSUME_SENDFILE if (written == -1 && errno == ENOSYS) goto use_write; @@ -313,7 +313,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, use_write: # endif #endif - written = writeall (fd, &dataset->resp, total); + written = writeall (fd, &dataset->resp, dataset->head.recsize); } /* Add the record to the database. But only if it has not been |