This is the mail archive of the glibc-bugs@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]

[Bug nis/20978] strlen on null pointer in nss_nisplus


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

--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/pr21120/2.24 has been created
        at  7cfdcd57fb1ab3396b1e871b54f46b13acdf4b9e (commit)

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7cfdcd57fb1ab3396b1e871b54f46b13acdf4b9e

commit 7cfdcd57fb1ab3396b1e871b54f46b13acdf4b9e
Author: Stefan Liebler <stli@linux.vnet.ibm.com>
Date:   Fri Feb 24 13:30:13 2017 +0100

    Get rid of duplicate const declaration specifier warning in
tst-resolv-qtypes.c.

    Compiling resolv/tst-resolv-qtypes.c with GCC 7 results in:
    tst-resolv-qtypes.c:53:14: error: duplicate ‘const’ declaration specifier
[-Werror=duplicate-decl-specifier]
     static const const char *domain = "www.example.com";

    This patch removes the duplicate const and makes domain a const pointer
    to const char literal.

    ChangeLog:

        * resolv/tst-resolv-qtypes.c (domain):
        Change type to const pointer to const char.

    (cherry picked from commit d4f94368a96541db2b38b6535402a941f5aff975)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4308d3fc8fab5b05707b7cc2f11cdb03cd89a16a

commit 4308d3fc8fab5b05707b7cc2f11cdb03cd89a16a
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Jan 4 23:33:31 2017 +0000

    Fix string/tester.c for GCC 7 -Wstringop-overflow=.

    GCC 7 has a -Wstringop-overflow= warning that includes warning for
    strncat with a size specified that is larger than the size of the
    buffer (which is dubious usage, but valid at runtime if in fact there
    isn't an overflow with the particular buffer contents present).
    string/tester.c tests such cases; this patch arranges for this warning
    to be ignored around relevant strncat calls.

    Tested compilation for aarch64 (GCC mainline) with
    build-many-glibcs.py; did execution testing for x86_64 (GCC 5).

        * string/tester.c (test_strncat): Disable -Wstringop-overflow=
        around tests of strncat with large sizes.

    (cherry picked from commit 3ecd616cc1782210d09c9678ec1a48899f19145b)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=76d8cfc034101aeda25ec3c2b1d3b58be99a10b6

commit 76d8cfc034101aeda25ec3c2b1d3b58be99a10b6
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Jan 4 23:32:14 2017 +0000

    Fix malloc/ tests for GCC 7 -Walloc-size-larger-than=.

    GCC 7 has a -Walloc-size-larger-than= warning for allocations of half
    the address space or more.  This causes errors building glibc tests
    that deliberately test failure of very large allocations.  This patch
    arranges for this warning to be ignored around the problematic
    function calls.

    Tested compilation for aarch64 (GCC mainline) with
    build-many-glibcs.py; did execution testing for x86_64 (GCC 5).

        * malloc/tst-malloc.c: Include <libc-internal.h>.
        (do_test): Disable -Walloc-size-larger-than= around tests of
        malloc with negative sizes.
        * malloc/tst-mcheck.c: Include <libc-internal.h>.
        (do_test): Disable -Walloc-size-larger-than= around tests of
        malloc and realloc with negative sizes.
        * malloc/tst-realloc.c: Include <libc-internal.h>.
        (do_test): Disable -Walloc-size-larger-than= around tests of
        realloc with negative sizes.

    (cherry picked from commit 3d7229c2507be1daf0c3e15e1f134076fa8b9025)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=45240ef5f46c231ef21216d2b681e4393c9658a9

commit 45240ef5f46c231ef21216d2b681e4393c9658a9
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Jan 11 14:02:23 2017 +0000

    Fix testsuite build for GCC 7 -Wformat-truncation.

    This patch fixes the glibc testsuite build for GCC 7
    -Wformat-truncation, newly moved out of -Wformat-length and with some
    further warnings that didn't previously appear.  Two tests that
    previously disabled -Wformat-length are changed to disable
    -Wformat-truncation instead; two others are made to disable that
    option as well.

    Tested (compilation only) with build-many-glibcs.py for aarch64 with
    GCC mainline.

        * stdio-common/tst-printf.c [__GNUC_PREREQ (7, 0)]: Ignore
        -Wformat-truncation instead of -Wformat-length.
        * time/tst-strptime2.c (mkbuf) [__GNUC_PREREQ (7, 0)]: Likewise.
        * stdio-common/tstdiomisc.c (F): Ignore -Wformat-truncation for
        GCC 7.
        * wcsmbs/tst-wcstof.c: Include <libc-internal.h>.
        (do_test): Ignore -Wformat-truncation for GCC 7.

    (cherry picked from commit 3c9378265a8633e2c85a393b54a16abcf64fe616)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ee5bfbe14c37667ed84d428e543a59765d9c8846

commit ee5bfbe14c37667ed84d428e543a59765d9c8846
Author: Steve Ellcey <sellcey@caviumnetworks.com>
Date:   Tue Nov 1 16:00:09 2016 -0700

    Fix warning from latest GCC in tst-printf.c

        * stdio-common/tst-printf.c: Ignore -Wformat-length warning.

    (cherry picked from commit 9032070deaa03431921315f973c548c2c403fecc)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b343a6c400a449040d828fa17903e82818150c4d

commit b343a6c400a449040d828fa17903e82818150c4d
Author: Steve Ellcey <sellcey@caviumnetworks.com>
Date:   Wed Nov 2 16:00:39 2016 -0700

    Fix -Wformat-length warning in time/tst-strptime2.c

        * time/tst-strptime2.c: Ignore -Wformat-length warning.

    (cherry picked from commit 26d7185d6f0a79188fdf02c5eec6e52bb29112f8)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a8d2af4a108dc4702cf7af55cd3e7c97fe608bf5

commit a8d2af4a108dc4702cf7af55cd3e7c97fe608bf5
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Dec 21 23:44:01 2016 +0000

    Fix nss_nisplus build with mainline GCC (bug 20978).

    glibc build with current mainline GCC fails because
    nis/nss_nisplus/nisplus-alias.c contains code

      if (name != NULL)
        {
          *errnop = EINVAL;
          return NSS_STATUS_UNAVAIL;
        }

      char buf[strlen (name) + 9 + tablename_len];

    producing an error about strlen being called on a pointer that is
    always NULL (and a subsequent use of that pointer with a %s format in
    snprintf).

    As Andreas noted, the bogus conditional comes from a 1997 change:

    -  if (name == NULL || strlen(name) > 8)
    -    return NSS_STATUS_NOTFOUND;
    -  else
    +  if (name != NULL || strlen(name) <= 8)

    So the intention is clearly to return an error for NULL name.

    This patch duly inverts the sense of the conditional.  It fixes the
    build with GCC mainline, and passes usual glibc testsuite testing for
    x86_64.  However, I have not tried any actual substantive nisplus
    testing, do not have an environment for such testing, and do not know
    whether it is possible that strlen (name) or tablename_len might be
    large so that the VLA for buf is actually a security issue.  However,
    if it is a security issue, there are plenty of other similar instances
    in the nisplus code (that haven't been hidden by a bogus comparison
    with NULL) - and nis_table.c:__create_ib_request uses strdupa on the
    string passed to nis_list, so a local fix in the caller wouldn't
    suffice anyway (see bug 20987).  (Calls to strdupa and other such
    macros that use alloca must be considered equally questionable
    regarding stack overflow issues as direct calls to alloca and VLA
    declarations.)

        [BZ #20978]
        * nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_getaliasbyname_r):
        Compare name == NULL, not name != NULL.

    (cherry picked from commit f88759ea9bd3c8d8fef28f123ba9767cb0e421a3)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ee074bc17f6a9c81484e564cbacb55891390a78f

commit ee074bc17f6a9c81484e564cbacb55891390a78f
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Tue Nov 8 23:44:51 2016 +0000

    Fix rpcgen buffer overrun (bug 20790).

    Building with GCC 7 produces an error building rpcgen:

    rpc_parse.c: In function 'get_prog_declaration':
    rpc_parse.c:543:25: error: may write a terminating nul past the end of the
destination [-Werror=format-length=]
         sprintf (name, "%s%d", ARGNAME, num); /* default name of argument */
                         ~~~~^
    rpc_parse.c:543:5: note: format output between 5 and 14 bytes into a
destination of size 10
         sprintf (name, "%s%d", ARGNAME, num); /* default name of argument */
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    That buffer overrun is for the case where the .x file declares a
    program with a million arguments.  The strcpy two lines above can
    generate a buffer overrun much more simply for a long argument name.

    The limit on length of line read by rpcgen (MAXLINESIZE == 1024)
    provides a bound on the buffer size needed, so this patch just changes
    the buffer size to MAXLINESIZE to avoid both possible buffer
    overruns.  A testcase is added that rpcgen does not crash with a
    500-character argument name, where it previously crashed.

    It would not at all surprise me if there are many other ways of
    crashing rpcgen with either valid or invalid input; fuzz testing would
    likely find various such bugs, though I don't think they are that
    important to fix (rpcgen is not that likely to be used with untrusted
    .x files as input).  (As well as fuzz-findable bugs there are probably
    also issues when various int variables get overflowed on very large
    input.)  The test infrastructure for rpcgen-not-crashing tests would
    need extending if tests are to be added for cases where rpcgen should
    produce an error, as opposed to cases where it should succeed.

    Tested for x86_64 and x86.

        [BZ #20790]
        * sunrpc/rpc_parse.c (get_prog_declaration): Increase buffer size
        to MAXLINESIZE.
        * sunrpc/bug20790.x: New file.
        * sunrpc/Makefile [$(run-built-tests) = yes] (rpcgen-tests): New
        variable.
        [$(run-built-tests) = yes] (tests-special): Add $(rpcgen-tests).
        [$(run-built-tests) = yes] ($(rpcgen-tests)): New rule.

    (cherry picked from commit 5874510faaf3cbd0bb112aaacab9f225002beed1)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cfc025ebb627c50d4f777c64fb6584c02e291690

commit cfc025ebb627c50d4f777c64fb6584c02e291690
Author: Florian Weimer <fweimer@redhat.com>
Date:   Tue Jun 13 22:09:59 2017 +0200

    configure: Suppress expected compiler error message

    (cherry picked from commit c2528fef3b05bcffb1ac27c6c09cc3ff24b7f03f)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=67ca4485d7ab9384278d4104d18ece4f6c339c79

commit 67ca4485d7ab9384278d4104d18ece4f6c339c79
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jun 13 09:28:14 2017 -0700

    Make copy of <bits/std_abs.h> from GCC 7 [BZ #21573]

    <bits/std_abs.h> from GCC 7 will include /usr/include/stdlib.h from
    "#include_next" (instead of stdlib/stdlib.h in the glibc source
    directory), and this turns up as a make dependency.  Also make a copy
    of <bits/std_abs.h> to prevent it from including /usr/include/stdlib.h.

        [BZ #21573]
        * Makerules [$(c++-bits-std_abs-h) != ""] (before-compile): Add
        $(common-objpfx)bits/std_abs.h.
        [$(c++-bits-std_abs-h) != ""] ($(common-objpfx)bits/std_abs.h):
        New target.
        * config.make.in (c++-bits-std_abs-h): New.
        * configure.ac (find_cxx_header): Use "\,$1," with sed.
        (CXX_BITS_STD_ABS_H): New.
        (AC_SUBST(CXX_BITS_STD_ABS_H)): Likewise.
        * configure: Regenerated.

    (cherry picked from commit a65ea28d1833d3502c5070472e43bda04410e6b5)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3387375fc8f737f44079f7a682501d4f0d090e60

commit 3387375fc8f737f44079f7a682501d4f0d090e60
Author: Florian Weimer <fweimer@redhat.com>
Date:   Wed Sep 21 10:45:32 2016 +0200

    Avoid running $(CXX) during build to obtain header file paths

    This reduces the build time somewhat and is particularly noticeable
    during rebuilds with few code changes.

    (cherry picked from commit fc3e1337be1c6935ab58bd13520f97a535cf70cc)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f8e29d9269e985ec62383cd2b73f3715ed65afb2

commit f8e29d9269e985ec62383cd2b73f3715ed65afb2
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Jun 29 10:26:04 2017 -0700

    i386: Increase MALLOC_ALIGNMENT to 16 [BZ #21120]

    GCC 7 changed the definition of max_align_t on i386:

   
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9b5c49ef97e63cc63f1ffa13baf771368105ebe2

    As a result, glibc malloc no longer returns memory blocks which are as
    aligned as max_align_t requires.

    This causes malloc/tst-malloc-thread-fail to fail with an error like this
    one:

    error: allocation function 0, size 144 not aligned to 16

    This patch increases the malloc alignment to 16 for i386.

        [BZ #21120]
        * sysdeps/generic/malloc-alignment.h: New file.
        * sysdeps/i386/malloc-alignment.h: Likewise.
        * sysdeps/generic/malloc-machine.h: Include <malloc-alignment.h>.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=64a9f6a8acbbc0f7cd9c9532f5f16acefef15276

commit 64a9f6a8acbbc0f7cd9c9532f5f16acefef15276
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Jun 23 14:38:46 2017 -0700

    Avoid .symver on common symbols [BZ #21666]

    The .symver directive on common symbol just creates a new common symbol,
    not an alias and the newer assembler with the bug fix for

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

    will issue an error.  Before the fix, we got

    $ readelf -sW libc.so | grep "loc[12s]"
      5109: 00000000003a0608     8 OBJECT  LOCAL  DEFAULT   36 loc1
      5188: 00000000003a0610     8 OBJECT  LOCAL  DEFAULT   36 loc2
      5455: 00000000003a0618     8 OBJECT  LOCAL  DEFAULT   36 locs
      6575: 00000000003a05f0     8 OBJECT  GLOBAL DEFAULT   36 locs@GLIBC_2.2.5
      7156: 00000000003a05f8     8 OBJECT  GLOBAL DEFAULT   36 loc1@GLIBC_2.2.5
      7312: 00000000003a0600     8 OBJECT  GLOBAL DEFAULT   36 loc2@GLIBC_2.2.5

    in libc.so.  The versioned loc1, loc2 and locs have the wrong addresses.
    After the fix, we got

    $ readelf -sW libc.so | grep "loc[12s]"
      6570: 000000000039e3b8     8 OBJECT  GLOBAL DEFAULT   34 locs@GLIBC_2.2.5
      7151: 000000000039e3c8     8 OBJECT  GLOBAL DEFAULT   34 loc1@GLIBC_2.2.5
      7307: 000000000039e3c0     8 OBJECT  GLOBAL DEFAULT   34 loc2@GLIBC_2.2.5

        [BZ #21666]
        * misc/regexp.c (loc1): Add __attribute__ ((nocommon));
        (loc2): Likewise.
        (locs): Likewise.

    (cherry picked from commit 388b4f1a02f3a801965028bbfcd48d905638b797)

-----------------------------------------------------------------------

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

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