Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
412a23c5
Commit
412a23c5
authored
6 years ago
by
George Joseph
Committed by
Gerrit Code Review
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge "app_voicemail: Fix stack overrun in append_mailbox" into 15
parents
4d7558f7
47214d4d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/app_voicemail.c
+16
-13
16 additions, 13 deletions
apps/app_voicemail.c
with
16 additions
and
13 deletions
apps/app_voicemail.c
+
16
−
13
View file @
412a23c5
...
@@ -793,11 +793,16 @@ struct baseio {
...
@@ -793,11 +793,16 @@ struct baseio {
unsigned char iobuf[BASEMAXINLINE];
unsigned char iobuf[BASEMAXINLINE];
};
};
#define MAX_VM_MBOX_ID_LEN (AST_MAX_EXTENSION)
#define MAX_VM_CONTEXT_LEN (AST_MAX_CONTEXT)
/* MAX_VM_MAILBOX_LEN allows enough room for the '@' and NULL terminator */
#define MAX_VM_MAILBOX_LEN (MAX_VM_MBOX_ID_LEN + MAX_VM_CONTEXT_LEN)
/*! Structure for linked list of users
/*! Structure for linked list of users
* Use ast_vm_user_destroy() to free one of these structures. */
* Use ast_vm_user_destroy() to free one of these structures. */
struct ast_vm_user {
struct ast_vm_user {
char context[
AST_
MAX_CONTEXT
];
/*!< Voicemail context */
char context[MAX
_VM
_CONTEXT
_LEN];
/*!< Voicemail context */
char mailbox[
AST_MAX_EXTENSIO
N];
/*!< Mailbox id, unique within vm context */
char mailbox[
MAX_VM_MBOX_ID_LE
N];/*!< Mailbox id, unique within vm context */
char password[80]; /*!< Secret pin code, numbers only */
char password[80]; /*!< Secret pin code, numbers only */
char fullname[80]; /*!< Full name, for directory app */
char fullname[80]; /*!< Full name, for directory app */
char *email; /*!< E-mail address */
char *email; /*!< E-mail address */
...
@@ -12273,23 +12278,21 @@ static int mark_or_create_poll_state(struct ast_vm_user *vmu)
...
@@ -12273,23 +12278,21 @@ static int mark_or_create_poll_state(struct ast_vm_user *vmu)
{
{
size_t len;
size_t len;
struct poll_state *poll_state;
struct poll_state *poll_state;
char
*
mailbox;
char mailbox
_full[MAX_VM_MAILBOX_LEN]
;
if (ast_strlen_zero(vmu->mailbox)) {
if (ast_strlen_zero(vmu->mailbox)) {
ast_log(LOG_ERROR, "Mailbox can't be empty\n");
ast_log(LOG_ERROR, "Mailbox can't be empty\n");
return -1;
return -1;
}
}
len = sizeof(vmu->mailbox) + sizeof(vmu->context) + sizeof('@') + 1;
len = snprintf(mailbox_full, MAX_VM_MAILBOX_LEN, "%s%s%s",
mailbox = ast_alloca(len);
len = snprintf(mailbox, len, "%s%s%s",
vmu->mailbox,
vmu->mailbox,
ast_strlen_zero(vmu->context) ? "" : "@",
ast_strlen_zero(vmu->context) ? "" : "@",
vmu->context);
vmu->context);
len++; /* For NULL terminator */
len++; /* For NULL terminator */
poll_state = ao2_find(poll_list, mailbox, OBJ_SEARCH_KEY);
poll_state = ao2_find(poll_list, mailbox
_full
, OBJ_SEARCH_KEY);
if (poll_state) {
if (poll_state) {
poll_state->marked_used = 1;
poll_state->marked_used = 1;
ao2_ref(poll_state, -1);
ao2_ref(poll_state, -1);
...
@@ -12301,7 +12304,7 @@ static int mark_or_create_poll_state(struct ast_vm_user *vmu)
...
@@ -12301,7 +12304,7 @@ static int mark_or_create_poll_state(struct ast_vm_user *vmu)
if (!poll_state) {
if (!poll_state) {
return -1;
return -1;
}
}
strcpy(poll_state->mailbox, mailbox); /* Safe */
strcpy(poll_state->mailbox, mailbox
_full
); /* Safe */
poll_state->marked_used = 1;
poll_state->marked_used = 1;
ao2_link_flags(poll_list, poll_state, OBJ_NOLOCK);
ao2_link_flags(poll_list, poll_state, OBJ_NOLOCK);
...
@@ -12366,7 +12369,7 @@ static int append_mailbox(const char *context, const char *box, const char *data
...
@@ -12366,7 +12369,7 @@ static int append_mailbox(const char *context, const char *box, const char *data
char *stringp;
char *stringp;
char *s;
char *s;
struct ast_vm_user *vmu;
struct ast_vm_user *vmu;
char
*
mailbox_full;
char mailbox_full
[MAX_VM_MAILBOX_LEN]
;
int new = 0, old = 0, urgent = 0;
int new = 0, old = 0, urgent = 0;
char secretfn[PATH_MAX] = "";
char secretfn[PATH_MAX] = "";
...
@@ -12405,10 +12408,10 @@ static int append_mailbox(const char *context, const char *box, const char *data
...
@@ -12405,10 +12408,10 @@ static int append_mailbox(const char *context, const char *box, const char *data
read_password_from_file(secretfn, vmu->password, sizeof(vmu->password));
read_password_from_file(secretfn, vmu->password, sizeof(vmu->password));
}
}
mailbox_full
= ast_alloca(strlen(box) + strlen(context) + 1);
snprintf(
mailbox_full
, MAX_VM_MAILBOX_LEN, "%s%s%s",
strcpy(mailbox_full, box);
box,
strcat(mailbox_full,
"@"
);
ast_strlen_zero(context) ? "" :
"@"
,
strcat(mailbox_full,
context);
context);
inboxcount2(mailbox_full, &urgent, &new, &old);
inboxcount2(mailbox_full, &urgent, &new, &old);
#ifdef IMAP_STORAGE
#ifdef IMAP_STORAGE
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment