unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Carlos O'Donell via Libc-alpha <libc-alpha@sourceware.org>
To: Florian Weimer <fweimer@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH] nis: nis_local_group may read from __nisgroup[-1] (bug 28075)
Date: Sun, 11 Jul 2021 10:58:40 -0400	[thread overview]
Message-ID: <87c6b7a6-85ea-1c1d-9181-7619bdd3a0f9@redhat.com> (raw)
In-Reply-To: <87tul0ex4t.fsf@oldenburg.str.redhat.com>

On 7/11/21 10:35 AM, Florian Weimer via Libc-alpha wrote:
> Tested on i686-linux-gnu and x86_64-linux-gnu.

In nis/* there are 6 uses of getenv.

The other users: __nis_default_owner, __nis_default_group,
__nis_default_ttl, __nis_default_access, all use strstr to
determine the position of parameters and don't suffer the
same problem (empty env var), likewise nis_getnames but with
__srtok_r. The code you are fixing doesn't appear to consider
an empty env var. I also looked up the call chain to see if
nis_clone_object inspected the group to see if it was empty
and it does, and so it appears safe.

LGTM.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
 
> ---
>  nis/nis_local_names.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/nis/nis_local_names.c b/nis/nis_local_names.c
> index 080dcf88bd..218764f32e 100644
> --- a/nis/nis_local_names.c
> +++ b/nis/nis_local_names.c
> @@ -31,6 +31,7 @@ nis_local_group (void)
>    char *cptr;
>    if (__nisgroup[0] == '\0'
>        && (cptr = getenv ("NIS_GROUP")) != NULL
> +      && cptr[0] != '\0'
>        && strlen (cptr) < NIS_MAXNAMELEN)
>      {
>        char *cp = stpcpy (__nisgroup, cptr);
> 


-- 
Cheers,
Carlos.


      reply	other threads:[~2021-07-11 14:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-11 14:35 [PATCH] nis: nis_local_group may read from __nisgroup[-1] (bug 28075) Florian Weimer via Libc-alpha
2021-07-11 14:58 ` Carlos O'Donell via Libc-alpha [this message]

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

  List information: https://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=87c6b7a6-85ea-1c1d-9181-7619bdd3a0f9@redhat.com \
    --to=libc-alpha@sourceware.org \
    --cc=carlos@redhat.com \
    --cc=fweimer@redhat.com \
    /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).