diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-03-08 05:04:11 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-03-08 05:04:11 +0000 |
commit | a8dc16728aead63c235e13f873e12322a9cb23f8 (patch) | |
tree | 0efa4a7afa46d166cb5b7dad58d41cf54f1e4c15 | |
parent | 4d0601f9ce9b11b38c93baeef08fe1baf525518f (diff) |
Fix strncpy auditing (bug #1152)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2370 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | apps/app_voicemail.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index dd3e315fb..9272ce6e5 100755 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -2269,7 +2269,7 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i system(sys); todircount = count_messages(todir); - strncpy(tmp, fmt, sizeof(tmp)); + strncpy(tmp, fmt, sizeof(tmp) - 1); stringp = tmp; while((s = strsep(&stringp, "|"))) { /* XXX This is a hack -- we should use build_filename or similar XXX */ @@ -3019,22 +3019,22 @@ static int append_mailbox(char *context, char *mbox, char *data) char *stringp; char *s; struct ast_vm_user *vmu; - strncpy(tmp, data, sizeof(tmp)); + strncpy(tmp, data, sizeof(tmp) - 1); vmu = malloc(sizeof(struct ast_vm_user)); if (vmu) { memset(vmu, 0, sizeof(struct ast_vm_user)); - strncpy(vmu->context, context, sizeof(vmu->context)); - strncpy(vmu->mailbox, mbox, sizeof(vmu->mailbox)); + strncpy(vmu->context, context, sizeof(vmu->context) - 1); + strncpy(vmu->mailbox, mbox, sizeof(vmu->mailbox) - 1); vmu->attach = -1; stringp = tmp; if ((s = strsep(&stringp, ","))) - strncpy(vmu->password, s, sizeof(vmu->password)); + strncpy(vmu->password, s, sizeof(vmu->password) - 1); if (stringp && (s = strsep(&stringp, ","))) - strncpy(vmu->fullname, s, sizeof(vmu->fullname)); + strncpy(vmu->fullname, s, sizeof(vmu->fullname) - 1); if (stringp && (s = strsep(&stringp, ","))) - strncpy(vmu->email, s, sizeof(vmu->email)); + strncpy(vmu->email, s, sizeof(vmu->email) - 1); if (stringp && (s = strsep(&stringp, ","))) - strncpy(vmu->pager, s, sizeof(vmu->pager)); + strncpy(vmu->pager, s, sizeof(vmu->pager) - 1); if (stringp && (s = strsep(&stringp, ","))) apply_options(vmu, s); vmu->next = NULL; |