]> git.pld-linux.org Git - packages/glibc.git/blob - glibc-nis-build.patch
47bc6d3fb5527cfaee368d0ebbccd02a39cdbb48
[packages/glibc.git] / glibc-nis-build.patch
1 commit 780684eb04298977bc411ebca1eadeeba4877833
2 Author: Maciej W. Rozycki <macro@mips.com>
3 Date:   Wed Jun 27 21:12:16 2018 +0100
4
5     nisplus: Correct pwent parsing issue and resulting build error [BZ #23266]
6     
7     Copy and null-terminate NIS+ password file UID and GID entries whose
8     length is non-zero and are not terminated, in addition to empty ones,
9     fixing a bug and a compilation issue causing an error with GCC 8:
10     
11     nss_nisplus/nisplus-parser.c: In function '_nss_nisplus_parse_pwent':
12     nss_nisplus/nisplus-parser.c:90:7: error: 'strncpy' destination unchanged after copying no bytes [-Werror=stringop-truncation]
13            strncpy (first_unused, numstr, len);
14            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15     nss_nisplus/nisplus-parser.c:106:7: error: 'strncpy' destination unchanged after copying no bytes [-Werror=stringop-truncation]
16            strncpy (first_unused, numstr, len);
17            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18     
19     introduced with commit ac05397075f6:
20     
21     commit ac05397075f621cfdbe1db527c96167a58b6d18e
22     Author: Ulrich Drepper <drepper@redhat.com>
23     Date:   Sun Apr 30 07:01:26 2006 +0000
24     
25             * nis/nss_nisplus/nisplus-parser.c: Minor optimizations and
26             cleanups.  Avoid copying data if it can be used in the old place.
27     
28     (no mailing list reference available).  Obviously regardless of the
29     recently added compiler diagnostics causing a build error this code has
30     been long non-functional, so I guess NIS+ servers have been supplying
31     strings that are non-empty and have already been null-terminated.
32     Which in turn made it unnecessary to make a null-terminated copy,
33     masking this bug.
34     
35             [BZ #23266]
36             * nis/nss_nisplus/nisplus-parser.c (_nss_nisplus_parse_pwent):
37             Copy and null-terminate entries that are not terminated, in
38             addition to empty ones.
39
40 diff --git a/nis/nss_nisplus/nisplus-parser.c b/nis/nss_nisplus/nisplus-parser.c
41 index 8dc021e73d..d2b06334c2 100644
42 --- a/nis/nss_nisplus/nisplus-parser.c
43 +++ b/nis/nss_nisplus/nisplus-parser.c
44 @@ -82,7 +82,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
45  
46    char *numstr = NISOBJVAL (2, obj);
47    len = NISOBJLEN (2, obj);
48 -  if (len == 0 && numstr[len - 1] != '\0')
49 +  if (len == 0 || numstr[len - 1] != '\0')
50      {
51        if (len >= room_left)
52         goto no_more_room;
53 @@ -98,7 +98,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
54  
55    numstr = NISOBJVAL (3, obj);
56    len = NISOBJLEN (3, obj);
57 -  if (len == 0 && numstr[len - 1] != '\0')
58 +  if (len == 0 || numstr[len - 1] != '\0')
59      {
60        if (len >= room_left)
61         goto no_more_room;
This page took 0.02427 seconds and 2 git commands to generate.