Skip to content

Commit a28421a

Browse files
committed
app_if: Fix format truncation errors.
Fixes format truncation warnings in gcc 12.2.1. ASTERISK-30349 #close Change-Id: I42be4edf0284358b906e765d1966b6b9d66e1d3c
1 parent de3ce17 commit a28421a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

apps/app_if.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ static int if_helper(struct ast_channel *chan, const char *data, int end)
234234
const char *if_pri = NULL;
235235
char *my_name = NULL;
236236
const char *label = NULL;
237-
char varname[VAR_SIZE], end_varname[VAR_SIZE + 4];
237+
char varname[VAR_SIZE + 3]; /* + IF_ */
238+
char end_varname[sizeof(varname) + 4]; /* + END_ + sizeof(varname) */
238239
const char *prefix = "IF";
239240
size_t size = 0;
240241
int used_index_i = -1, x = 0;
@@ -252,8 +253,8 @@ static int if_helper(struct ast_channel *chan, const char *data, int end)
252253
}
253254
}
254255

255-
snprintf(used_index, VAR_SIZE, "%d", used_index_i);
256-
snprintf(new_index, VAR_SIZE, "%d", used_index_i + 1);
256+
snprintf(used_index, sizeof(used_index), "%d", used_index_i);
257+
snprintf(new_index, sizeof(new_index), "%d", used_index_i + 1);
257258

258259
size = strlen(ast_channel_context(chan)) + strlen(ast_channel_exten(chan)) + 32;
259260
my_name = ast_alloca(size);

0 commit comments

Comments
 (0)