Merge josh's strlen fix (thanks!) (bug #2893)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer 2005-01-03 01:16:00 +00:00
parent 0c3cea35f0
commit 056325aca6
1 changed files with 2 additions and 2 deletions

View File

@ -4461,7 +4461,7 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_
return -1; return -1;
} }
} }
if (prefix) { if (prefix && !ast_strlen_zero(prefix)) {
char fullusername[80] = ""; char fullusername[80] = "";
strncpy(fullusername, prefix, sizeof(fullusername) - 1); strncpy(fullusername, prefix, sizeof(fullusername) - 1);
strncat(fullusername, mailbox, sizeof(fullusername) - 1 - strlen(fullusername)); strncat(fullusername, mailbox, sizeof(fullusername) - 1 - strlen(fullusername));
@ -4476,7 +4476,7 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_
else { else {
if (option_verbose > 2) if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "Incorrect password '%s' for user '%s' (context = %s)\n", password, mailbox, context ? context : "<any>"); ast_verbose( VERBOSE_PREFIX_3 "Incorrect password '%s' for user '%s' (context = %s)\n", password, mailbox, context ? context : "<any>");
if (prefix) if (prefix && !ast_strlen_zero(prefix))
strncpy(mailbox, "", mailbox_size -1); strncpy(mailbox, "", mailbox_size -1);
} }
logretries++; logretries++;