From 14c6f8be9de82de1993359e928a4d992aa4513b0 Mon Sep 17 00:00:00 2001 From: Sean Bright <sean.bright@gmail.com> Date: Tue, 21 Aug 2018 14:50:33 -0400 Subject: [PATCH] app_queue: Silence GCC 8 compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- apps/app_queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/app_queue.c b/apps/app_queue.c index ee252f99e2..136dec59c0 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -10354,7 +10354,7 @@ static char *complete_queue_add_member(const char *line, const char *word, int p 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); -- GitLab