public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "byrnes at deshaw dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug nscd/31572] New: getnetgrent_r stores results outside buffer if nscd is running
Date: Thu, 28 Mar 2024 19:08:38 +0000	[thread overview]
Message-ID: <bug-31572-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=31572

            Bug ID: 31572
           Summary: getnetgrent_r stores results outside buffer if nscd is
                    running
           Product: glibc
           Version: 2.39
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: nscd
          Assignee: unassigned at sourceware dot org
          Reporter: byrnes at deshaw dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Created attachment 15442
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15442&action=edit
repro.c - reproducer for getnetgrent_r nscd bug

If nscd is running, getnetgrent_r stores (user, group, domain) strings outside
of the specified buffer.

This easy to reproduce:

Compile the attached program with gcc -DNETGROUP=\"valid-netgroup-name\" ...

Run on a system with nscd running and configured to enable netgroup caching,
and with glibc configured to use nscd.  Observe the assertion failures because
(user, group, domain) point to locations outside of the buffer.

I think this happens because nscd_getnetgrent doesn't use the buffer at all.

I can reproduce this on all glibc versions that I've tried between 2.28 and
2.38 - I believe it will also reproduce on the latest 2.39.

This is bad because the strings in the buffer are supposed to remain valid even
after other netgroup-related functions are called, but I suspect that's not
really true when the results are elsewhere.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2024-03-28 19:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 19:08 byrnes at deshaw dot com [this message]
2024-03-29  4:24 ` [Bug nscd/31572] " sam at gentoo dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31572-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).