diff options
author | Florian Weimer <fweimer@redhat.com> | 2024-04-25 15:01:07 +0200 |
---|---|---|
committer | Andreas K. Hüttel <dilfridge@gentoo.org> | 2024-04-26 17:17:21 +1100 |
commit | b502c954fa64e47d8cc36df35afb9289627821c3 (patch) | |
tree | e6e897b893e4dec79db0083d4e1c385234fae40c | |
parent | CVE-2024-33599: nscd: Stack-based buffer overflow in netgroup cache (bug 31677) (diff) | |
download | glibc-b502c954fa64e47d8cc36df35afb9289627821c3.tar.gz glibc-b502c954fa64e47d8cc36df35afb9289627821c3.tar.bz2 glibc-b502c954fa64e47d8cc36df35afb9289627821c3.zip |
CVE-2024-33600: nscd: Do not send missing not-found response in addgetnetgrentX (bug 31678)
If we failed to add a not-found response to the cache, the dataset
point can be null, resulting in a null pointer dereference.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
(cherry picked from commit 7835b00dbce53c3c87bbbb1754a95fb5e58187aa)
(cherry picked from commit 5a508e0b508c8ad53bd0d2fb48fd71b242626341)
-rw-r--r-- | nscd/netgroupcache.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c index f227dc7fa2..c18fe111f3 100644 --- a/nscd/netgroupcache.c +++ b/nscd/netgroupcache.c @@ -147,7 +147,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req, /* No such service. */ cacheable = do_notfound (db, fd, req, key, &dataset, &total, &timeout, &key_copy); - goto writeout; + goto maybe_cache_add; } memset (&data, '\0', sizeof (data)); @@ -348,7 +348,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req, { cacheable = do_notfound (db, fd, req, key, &dataset, &total, &timeout, &key_copy); - goto writeout; + goto maybe_cache_add; } total = buffilled; @@ -410,14 +410,12 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req, } if (he == NULL && fd != -1) - { - /* We write the dataset before inserting it to the database - since while inserting this thread might block and so would - unnecessarily let the receiver wait. */ - writeout: + /* We write the dataset before inserting it to the database since + while inserting this thread might block and so would + unnecessarily let the receiver wait. */ writeall (fd, &dataset->resp, dataset->head.recsize); - } + maybe_cache_add: if (cacheable) { /* If necessary, we also propagate the data to disk. */ |