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

Friendly Automation (JIRA) noreply at issues.asterisk.org
Mon Oct 10 09:57:09 CDT 2022


     [ https://issues.asterisk.org/jira/browse/ASTERISK-30256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Friendly Automation closed ASTERISK-30256.
------------------------------------------

    Resolution: Fixed

> 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
>            Assignee: 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