bug-groff
[Top][All Lists]
Advanced

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

[bug #55257] xtotroff.c: Defined size of the array "encoding" is too sho


From: Bjarni Ingi Gislason
Subject: [bug #55257] xtotroff.c: Defined size of the array "encoding" is too short
Date: Thu, 20 Dec 2018 15:54:03 -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/?55257>

                 Summary: xtotroff.c: Defined size of the array "encoding" is
too short
                 Project: GNU troff
            Submitted by: bjarniig
            Submitted on: Thu 20 Dec 2018 08:54:01 PM UTC
                Category: None
                Severity: 3 - Normal
              Item Group: Build/Installation
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

From: Bjarni Ingi Gislason <address@hidden>
Date: Thu, 20 Dec 2018 20:47:07 +0000
Subject: xtotroff.c: Defined size of the array "encoding" is too short

  The X11 part of the groff software is only compiled if the needed
libraries are found, see README.

  Possible warnings from the compiler:

../src/utils/xtotroff/xtotroff.c: In function 'MapFont':
../src/utils/xtotroff/xtotroff.c:159:25: warning: '%s' directive writing
up to 255 bytes into a region of size between 0 and 255
[-Wformat-overflow=]
   sprintf(encoding, "%s-%s", parsed.CharSetRegistry,
                         ^~
    parsed.CharSetEncoding);
    ~~~~~~~~~~~~~~~~~~~~~~
../src/utils/xtotroff/xtotroff.c:159:3: note: 'sprintf' output between 2
and 512 bytes into a destination of size 256
   sprintf(encoding, "%s-%s", parsed.CharSetRegistry,
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    parsed.CharSetEncoding);
    ~~~~~~~~~~~~~~~~~~~~~~~

  The size of "encoding" needs thus to be the sizeof(CharSetRegistry) +
sizeof(CharSetEncoding) + 1 (+1 for the terminating null byte?), which
sizes are defined in "src/include/XFontName.h".





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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