This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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 ada/79309] New: incorrectly bounded calls to strncat in adaint.c


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79309

            Bug ID: 79309
           Summary: incorrectly bounded calls to strncat in adaint.c
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

A profiled-bootstrap reveals a few warnings in gcc/ada/adaint.c.  The Wnonnull
instance look like false positives but the -Wstringop-overflow warning points
out an incorrect use of the strncat function.

In file included from /src/gcc/git-svn/gcc/system.h:691:0,
                 from /src/gcc/git-svn/gcc/ada/adaint.c:107:
/src/gcc/git-svn/gcc/ada/adaint.c: In function ‘char* __gnat_locate_exec(char*,
char*)’:
/src/gcc/git-svn/gcc/ada/adaint.c:2837:12: warning: argument 1 null where
non-null expected [-Wnonnull]
    (strlen (exec_name) + strlen (HOST_EXECUTABLE_SUFFIX) + 1);
     ~~~~~~~^~~~~~~~~~~
/src/gcc/git-svn/gcc/../include/libiberty.h:722:37: note: in definition of
macro ‘alloca’
 # define alloca(x) __builtin_alloca(x)
                                     ^
In file included from
/ssd/build/gcc-git-svn-ubsan/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/cstring:42:0,
                 from /src/gcc/git-svn/gcc/system.h:235,
                 from /src/gcc/git-svn/gcc/ada/adaint.c:107:
/usr/include/string.h:398:15: note: in a call to function ‘size_t strlen(const
char*)’ declared here
 extern size_t strlen (const char *__s)
               ^~~~~~
/src/gcc/git-svn/gcc/ada/adaint.c:2839:14: warning: argument 2 null where
non-null expected [-Wnonnull]
       strcpy (full_exec_name, exec_name);
       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/ssd/build/gcc-git-svn-ubsan/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/cstring:42:0,
                 from /src/gcc/git-svn/gcc/system.h:235,
                 from /src/gcc/git-svn/gcc/ada/adaint.c:107:
/usr/include/string.h:129:14: note: in a call to function ‘char* strcpy(char*,
const char*)’ declared here
 extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
              ^~~~~~
/src/gcc/git-svn/gcc/ada/adaint.c: In function ‘void
__gnat_killprocesstree(int, int)’:
/src/gcc/git-svn/gcc/ada/adaint.c:3405:19: warning: specified bound 64 equals
the size of the destination [-Wstringop-overflow=]
           strncat (statfile, d->d_name, sizeof(statfile));
           ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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