From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id B129038460B2; Thu, 25 Apr 2024 13:39:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B129038460B2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1714052360; bh=UMujDNTwTz524ECrSQFqtjX4u/BQlY/2KgQNYoW4W18=; h=From:To:Subject:Date:From; b=lFhdsR+95FetApXyxGyNhkyzB4daJUQFgDBgMtdfmStXp5zj7fWXt+DIPaQRs3XgJ CsIUNCIb581+9p/R15dUtqMKW/Lkr2J5kRYPD+x+ybM/2DdHKrTlNumF8hV0NdKmFX i2S0kDN4ABNHwIs9uYwZWI14bt/rTeepgOBcTpUA= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc/release/2.39/master] CVE-2024-33600: nscd: Do not send missing not-found response in addgetnetgrentX (bug 31678) X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/release/2.39/master X-Git-Oldrev: 1263d583d2e28afb8be53f8d6922f0842036f35d X-Git-Newrev: 5a508e0b508c8ad53bd0d2fb48fd71b242626341 Message-Id: <20240425133920.B129038460B2@sourceware.org> Date: Thu, 25 Apr 2024 13:39:20 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5a508e0b508c8ad53bd0d2fb48fd71b242626341 commit 5a508e0b508c8ad53bd0d2fb48fd71b242626341 Author: Florian Weimer Date: Thu Apr 25 15:01:07 2024 +0200 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 (cherry picked from commit 7835b00dbce53c3c87bbbb1754a95fb5e58187aa) Diff: --- nscd/netgroupcache.c | 14 ++++++-------- 1 file 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. */