This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] nisplus: Correct pwent parsing issue and resulting compilation error
- From: Andreas Schwab <schwab at suse dot de>
- To: "Maciej W. Rozycki" <macro at mips dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Mon, 18 Jun 2018 17:41:43 +0200
- Subject: Re: [PATCH] nisplus: Correct pwent parsing issue and resulting compilation error
- References: <alpine.DEB.2.00.1806181539250.20622@tp.orcam.me.uk>
On Jun 18 2018, "Maciej W. Rozycki" <macro@mips.com> wrote:
> Index: glibc/nis/nss_nisplus/nisplus-parser.c
> ===================================================================
> --- glibc.orig/nis/nss_nisplus/nisplus-parser.c 2018-02-14 14:57:00.000000000 +0000
> +++ glibc/nis/nss_nisplus/nisplus-parser.c 2018-06-16 21:47:29.071633078 +0100
> @@ -82,7 +82,7 @@ _nss_nisplus_parse_pwent (nis_result *re
>
> char *numstr = NISOBJVAL (2, obj);
> len = NISOBJLEN (2, obj);
> - if (len == 0 && numstr[len - 1] != '\0')
> + if (len != 0 && numstr[len - 1] != '\0')
> {
> if (len >= room_left)
> goto no_more_room;
> @@ -98,7 +98,7 @@ _nss_nisplus_parse_pwent (nis_result *re
>
> numstr = NISOBJVAL (3, obj);
> len = NISOBJLEN (3, obj);
> - if (len == 0 && numstr[len - 1] != '\0')
> + if (len != 0 && numstr[len - 1] != '\0')
> {
> if (len >= room_left)
> goto no_more_room;
>
I don't think this is correct. If len == 0 then numstr[0] is undefined.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."