|
|
ca483c |
commit 7835b00dbce53c3c87bbbb1754a95fb5e58187aa
|
|
|
ca483c |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
ca483c |
Date: Thu Apr 25 15:01:07 2024 +0200
|
|
|
ca483c |
|
|
|
ca483c |
CVE-2024-33600: nscd: Do not send missing not-found response in addgetnetgrentX (bug 31678)
|
|
|
ca483c |
|
|
|
ca483c |
If we failed to add a not-found response to the cache, the dataset
|
|
|
ca483c |
point can be null, resulting in a null pointer dereference.
|
|
|
ca483c |
|
|
|
ca483c |
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
ca483c |
|
|
|
ca483c |
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
|
|
|
ca483c |
index 0a9d864109cdd8cd..d53c473c3e5139b8 100644
|
|
|
ca483c |
--- a/nscd/netgroupcache.c
|
|
|
ca483c |
+++ b/nscd/netgroupcache.c
|
|
|
ca483c |
@@ -148,7 +148,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
|
|
ca483c |
/* No such service. */
|
|
|
ca483c |
cacheable = do_notfound (db, fd, req, key, &dataset, &total, &timeout,
|
|
|
ca483c |
&key_copy);
|
|
|
ca483c |
- goto writeout;
|
|
|
ca483c |
+ goto maybe_cache_add;
|
|
|
ca483c |
}
|
|
|
ca483c |
|
|
|
ca483c |
memset (&data, '\0', sizeof (data));
|
|
|
ca483c |
@@ -349,7 +349,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
|
|
ca483c |
{
|
|
|
ca483c |
cacheable = do_notfound (db, fd, req, key, &dataset, &total, &timeout,
|
|
|
ca483c |
&key_copy);
|
|
|
ca483c |
- goto writeout;
|
|
|
ca483c |
+ goto maybe_cache_add;
|
|
|
ca483c |
}
|
|
|
ca483c |
|
|
|
ca483c |
total = buffilled;
|
|
|
ca483c |
@@ -411,14 +411,12 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
|
|
ca483c |
}
|
|
|
ca483c |
|
|
|
ca483c |
if (he == NULL && fd != -1)
|
|
|
ca483c |
- {
|
|
|
ca483c |
- /* We write the dataset before inserting it to the database
|
|
|
ca483c |
- since while inserting this thread might block and so would
|
|
|
ca483c |
- unnecessarily let the receiver wait. */
|
|
|
ca483c |
- writeout:
|
|
|
ca483c |
+ /* We write the dataset before inserting it to the database since
|
|
|
ca483c |
+ while inserting this thread might block and so would
|
|
|
ca483c |
+ unnecessarily let the receiver wait. */
|
|
|
ca483c |
writeall (fd, &dataset->resp, dataset->head.recsize);
|
|
|
ca483c |
- }
|
|
|
ca483c |
|
|
|
ca483c |
+ maybe_cache_add:
|
|
|
ca483c |
if (cacheable)
|
|
|
ca483c |
{
|
|
|
ca483c |
/* If necessary, we also propagate the data to disk. */
|