bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #54968] Resolve stringop-overflow warning in src/roff/troff/input.c


From: G. Branden Robinson
Subject: [bug #54968] Resolve stringop-overflow warning in src/roff/troff/input.cpp
Date: Tue, 6 Nov 2018 05:48:07 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0

URL:
  <https://savannah.gnu.org/bugs/?54968>

                 Summary: Resolve stringop-overflow warning in
src/roff/troff/input.cpp
                 Project: GNU troff
            Submitted by: gbranden
            Submitted on: Tue 06 Nov 2018 10:48:06 AM UTC
                Category: Core
                Severity: 3 - Normal
              Item Group: Build/Installation
                  Status: In Progress
                 Privacy: Public
             Assigned to: gbranden
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

GCC 8 dislikes it when the length argument to strncat is computed based on the
length of the source argument rather than the destination.  It's a reasonable
warning, but GCC is not smart enough to discern that our destination string
was allocated based on the length of a superset of the source string, and so
cannot overflow.

I have fix prepared for this.


  CXX      src/roff/troff/input.o
../src/roff/troff/input.cpp: In function ‘void macro_source()’:
../src/roff/troff/input.cpp:7716:11: warning: ‘char* strncat(char*, const
char*, size_t)’ specified bound depends on the length of the source argument
[-Wstringop-overflow=]
    strncat(s, fn, strlen(fn) - sizeof(MACRO_POSTFIX) + 1);
    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/roff/troff/input.cpp:7716:25: note: length computed here
    strncat(s, fn, strlen(fn) - sizeof(MACRO_POSTFIX) + 1);
                   ~~~~~~^~~~


$ gcc --version
gcc (Debian 8.2.0-9) 8.2.0





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54968>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]