[Home]

Summary:ASTERISK-30256: chan_dahdi: Fix format truncation warnings
Reporter:N A (InterLinked)Labels:
Date Opened:2022-10-01 17:07:26Date Closed:2022-10-10 09:55:26
Priority:MajorRegression?
Status:Closed/CompleteComponents:Channels/chan_dahdi
Versions:18.14.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:
Description: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}
Comments:By: Asterisk Team (asteriskteam) 2022-10-01 17:07:30.913-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Friendly Automation (friendly-automation) 2022-10-10 09:55:28.422-0500

Change 19422 merged by Friendly Automation:
chan_dahdi: Resolve format truncation warning.

[https://gerrit.asterisk.org/c/asterisk/+/19422|https://gerrit.asterisk.org/c/asterisk/+/19422]

By: Friendly Automation (friendly-automation) 2022-10-10 10:31:31.987-0500

Change 19425 merged by Friendly Automation:
chan_dahdi: Resolve format truncation warning.

[https://gerrit.asterisk.org/c/asterisk/+/19425|https://gerrit.asterisk.org/c/asterisk/+/19425]

By: Friendly Automation (friendly-automation) 2022-10-10 12:01:07.258-0500

Change 19424 merged by George Joseph:
chan_dahdi: Resolve format truncation warning.

[https://gerrit.asterisk.org/c/asterisk/+/19424|https://gerrit.asterisk.org/c/asterisk/+/19424]

By: Friendly Automation (friendly-automation) 2022-10-10 12:01:30.023-0500

Change 19423 merged by George Joseph:
chan_dahdi: Resolve format truncation warning.

[https://gerrit.asterisk.org/c/asterisk/+/19423|https://gerrit.asterisk.org/c/asterisk/+/19423]

By: Friendly Automation (friendly-automation) 2022-10-10 12:01:50.814-0500

Change 19403 merged by George Joseph:
chan_dahdi: Resolve format truncation warning.

[https://gerrit.asterisk.org/c/asterisk/+/19403|https://gerrit.asterisk.org/c/asterisk/+/19403]