[asterisk-commits] app queue: Silence GCC 8 compiler warning (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 22 11:23:54 CDT 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/9983 )

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

app_queue: Silence GCC 8 compiler warning

I'm only seeing an error in 14+, so I assume it is due to different
compiler options:

app_queue.c: In function ‘handle_queue_add_member’:
app_queue.c:10234:19: error: ‘%d’ directive writing between 1 and 11
    bytes into a region of size 3 [-Werror=format-overflow=]
     sprintf(num, "%d", state);
                   ^~
app_queue.c:10234:18: note: directive argument in the range
    [-2147483648, 99]
     sprintf(num, "%d", state);
                  ^~~~

Compiler: gcc version 8.0.1 20180414 (experimental)
    [trunk revision 259383] (Ubuntu 8-20180414-1ubuntu2) 

Change-Id: I18577590da46829c1ea7d8b82e41d69f105baa10
---
M apps/app_queue.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Matthew Fredrickson: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/apps/app_queue.c b/apps/app_queue.c
index ee252f9..136dec5 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -10354,7 +10354,7 @@
 	case 6: /* only one possible match, "penalty" */
 		return state == 0 ? ast_strdup("penalty") : NULL;
 	case 7:
-		if (state < 100) {      /* 0-99 */
+		if (0 <= state && state < 100) {      /* 0-99 */
 			char *num;
 			if ((num = ast_malloc(3))) {
 				sprintf(num, "%d", state);

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I18577590da46829c1ea7d8b82e41d69f105baa10
Gerrit-Change-Number: 9983
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20180822/8098533a/attachment.html>


More information about the asterisk-commits mailing list