This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [bz 22342] patch: fix netgroup cache keys


On 03/01/2018 02:11 PM, DJ Delorie wrote:
> Functionality tested on RHEL 7.  Regression tested on Fedora 26.
> 
> 	[BZ #22342]
> 	* nscd/netgroupcache.c (addinnetgrX): Include trailing NUL in
> 	key value.
> 
> diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
> index b832c9315f..2f187b208c 100644
> --- a/nscd/netgroupcache.c
> +++ b/nscd/netgroupcache.c
> @@ -480,7 +480,7 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
>  {
>    const char *group = key;
>    key = (char *) rawmemchr (key, '\0') + 1;
> -  size_t group_len = key - group - 1;
> +  size_t group_len = key - group;
>    const char *host = *key++ ? key : NULL;
>    if (host != NULL)
>      key = (char *) rawmemchr (key, '\0') + 1;
> 

Why is this correct?

A good submission includes a justification that the
fix is logically what is required.

We do not want to paper over a problem just by testing
that a given change makes things better.

Do we understand what the problem is?

The bug report appears to make the claim that there are
two paths in the code, one which adds to the cache with
the null included in the length, and another which doesn't,
which obviously results in a cache miss.

Is that the final case we are fixing here? Can you describe
this a bit more for the commit message?

Please post a v2 with the commit message you intend to use
please.

-- 
Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]