From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id A59C03858C78; Thu, 25 Apr 2024 14:13:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A59C03858C78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1714054401; bh=QRAzj4L/fEx9UxrpMLd1ZST7h98T0jdUuWjs2DaCFcw=; h=From:To:Subject:Date:From; b=WrHVuCV2uUJxWyDFYIKhRmKDexTzjwNqM2qV1WQmZB58nzY2g55Ye1pi8yX/mAi6B B+NqNWEJTXzHG+KW+Ma2OhnAC50xVmo50gq3N6uh8Coxf+r+cgEvSVFdFQCBMBv935 j8YA6n6pDTAx3RrdSQs12nWEUHNMzDeVyQAczqPA= 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.31/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.31/master X-Git-Oldrev: 69c58d5ef9f584ea198bd00f7964d364d0e6b921 X-Git-Newrev: 304ce5fe466c4762b21b36c26926a4657b59b53e Message-Id: <20240425141321.A59C03858C78@sourceware.org> Date: Thu, 25 Apr 2024 14:13:21 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=304ce5fe466c4762b21b36c26926a4657b59b53e commit 304ce5fe466c4762b21b36c26926a4657b59b53e 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 a833ef039e..c99cf5791b 100644 --- a/nscd/netgroupcache.c +++ b/nscd/netgroupcache.c @@ -148,7 +148,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)); @@ -349,7 +349,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; @@ -411,14 +411,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. */