[Asterisk-code-review] chan_dahdi.c: Resolve a format-truncation build warning. (asterisk[18])

Sean Bright asteriskteam at digium.com
Fri Aug 19 11:15:56 CDT 2022


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18983 )


Change subject: chan_dahdi.c: Resolve a format-truncation build warning.
......................................................................

chan_dahdi.c: Resolve a format-truncation build warning.

With gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0:

> chan_dahdi.c:4129:18: error: ā€˜%sā€™ directive output may be truncated
>   writing up to 255 bytes into a region of size between 242 and 252
>   [-Werror=format-truncation=]

Change-Id: I2d276785286730d3d5d0a921bcea2e065dbf27c5
---
M channels/chan_dahdi.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/83/18983/1

diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 8ce0526..1e9ae7e 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -4128,7 +4128,7 @@
 {
 #define CHAN_TAG "Chan "
 	char logmsg[256];
-	char completemsg[sizeof(logmsg) + sizeof(CHAN_TAG) - 1];
+	char completemsg[sizeof(logmsg) + sizeof(CHAN_TAG "-2147483648 - ") - 1];
 	vsnprintf(logmsg, sizeof(logmsg), fmt, ap);
 	snprintf(completemsg, sizeof(completemsg), CHAN_TAG "%d - %s", openr2_chan_get_number(r2chan), logmsg);
 	dahdi_r2_write_log(level, completemsg);

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18983
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I2d276785286730d3d5d0a921bcea2e065dbf27c5
Gerrit-Change-Number: 18983
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean at seanbright.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220819/a8b9aa9b/attachment.html>


More information about the asterisk-code-review mailing list