[asterisk-bugs] [JIRA] (ASTERISK-30256) chan_dahdi: Fix format truncation warnings

N A (JIRA) noreply at issues.asterisk.org
Sat Oct 1 17:08:08 CDT 2022


N A created ASTERISK-30256:
------------------------------

             Summary: chan_dahdi: Fix format truncation warnings
                 Key: ASTERISK-30256
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-30256
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Channels/chan_dahdi
    Affects Versions: 18.14.0
            Reporter: N A
            Severity: Major


Fixes format truncation warning with newer gcc:

{noformat}
chan_dahdi.c: In function ‘analog_ss_thread’:
chan_dahdi.c:3466:33: warning: ‘%d’ directive output may be truncated writing 1 byte into a region of size between 0 and 4256 [-Wformat-truncation=]
 3466 |   snprintf(s, sizeof(s), "%s %s %d", mwimonitornotify, mailbox, thereornot);
      |                                 ^~
In file included from /usr/include/stdio.h:867,
                 from /usr/src/asterisk-18.14.0/include/asterisk/compat.h:49,
                 from /usr/src/asterisk-18.14.0/include/asterisk.h:22,
                 from chan_dahdi.c:55:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 4 and 4260 bytes into a destination of size 4258
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
chan_dahdi.c:3466:33: warning: ‘%d’ directive output may be truncated writing 1 byte into a region of size between 0 and 4256 [-Wformat-truncation=]
 3466 |   snprintf(s, sizeof(s), "%s %s %d", mwimonitornotify, mailbox, thereornot);
      |                                 ^~
In file included from /usr/include/stdio.h:867,
                 from /usr/src/asterisk-18.14.0/include/asterisk/compat.h:49,
                 from /usr/src/asterisk-18.14.0/include/asterisk.h:22,
                 from chan_dahdi.c:55:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 4 and 4260 bytes into a destination of size 4258
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   [LD] chan_dahdi.o dahdi/bridge_native_dahdi.o sig_analog.o sig_pri.o sig_ss7.o -> chan_dahdi.so
{noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list