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
This commit is contained in:
Sean Bright 2018-08-21 14:50:33 -04:00
parent 6b527d11ae
commit 4b88cb383d
1 changed files with 1 additions and 1 deletions

View File

@ -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);