From: Sean Bright Date: Tue, 21 Aug 2018 18:50:33 +0000 (-0400) Subject: app_queue: Silence GCC 8 compiler warning X-Git-Tag: 13.23.0-rc1~7^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9d9c0a8b9963f232af6e540999059f381d5c1d6;p=thirdparty%2Fasterisk.git 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 --- diff --git a/apps/app_queue.c b/apps/app_queue.c index 31580b46b4..12f09ec3e3 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -9932,7 +9932,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);