Skip to content

Commit 4168fa3

Browse files
InterLinked1Friendly Automation
authored andcommitted
app_voicemail_odbc: Fix string overflow warning.
Fixes a negative offset warning by initializing the buffer to empty. Additionally, although it doesn't currently complain about it, the size of a buffer is increased to accomodate the maximum size contents it could have. ASTERISK-30240 #close Change-Id: I8eecedf14d3f2a75864797f802277cac89a32877
1 parent ee170ab commit 4168fa3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

apps/app_voicemail.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4484,15 +4484,16 @@ static void rename_file(char *sdir, int smsg, char *mailboxuser, char *mailboxco
44844484
*/
44854485
static int remove_file(char *dir, int msgnum)
44864486
{
4487-
char fn[PATH_MAX];
4488-
char full_fn[PATH_MAX];
4487+
char fn[PATH_MAX] = "";
4488+
char full_fn[PATH_MAX + 4]; /* Plus .txt */
44894489
char msgnums[80];
44904490

44914491
if (msgnum > -1) {
44924492
snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
44934493
make_file(fn, sizeof(fn), dir, msgnum);
4494-
} else
4494+
} else {
44954495
ast_copy_string(fn, dir, sizeof(fn));
4496+
}
44964497
ast_filedelete(fn, NULL);
44974498
snprintf(full_fn, sizeof(full_fn), "%s.txt", fn);
44984499
unlink(full_fn);

0 commit comments

Comments
 (0)