[Asterisk-code-review] app queue: Silence GCC 8 compiler warning (asterisk[13])

Sean Bright asteriskteam at digium.com
Tue Aug 21 20:07:57 CDT 2018


Sean Bright has posted comments on this change. ( https://gerrit.asterisk.org/9980 )

Change subject: app_queue: Silence GCC 8 compiler warning
......................................................................


Patch Set 2:

(1 comment)

https://gerrit.asterisk.org/#/c/9980/2/apps/app_queue.c
File apps/app_queue.c:

https://gerrit.asterisk.org/#/c/9980/2/apps/app_queue.c@9935
PS2, Line 9935: 		if (0 <= state && state < 100) {      /* 0-99 */
> What was the silly compiler complaining about?  This change makes
 > no sense.

The sprintf below is writing into a fixed size buffer 'num' of 3 bytes. Because 'state' is signed, anything less than -9 would cause 'num' to be unterminated.

In practice, we know that 'state' will not be negative, but the compiler doesn't know that.



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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: comment
Gerrit-Change-Id: I18577590da46829c1ea7d8b82e41d69f105baa10
Gerrit-Change-Number: 9980
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-Comment-Date: Wed, 22 Aug 2018 01:07:57 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180821/e47c4fdf/attachment-0001.html>


More information about the asterisk-code-review mailing list