summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-02-15 23:29:28 +0000
committerMatthew Jordan <mjordan@digium.com>2013-02-15 23:29:28 +0000
commitc209e85ad31ac3983a0eb7684055cdd808cbd8fe (patch)
tree4ad998c53caf879cc4c99a867911731e5341bf2f /funcs
parent8a7dd2f40880f988ea017294ad8001bf0e1825b5 (diff)
Fix crash in PresenceState AMI action when specifying an invalid provider
This patch fixes a crash in Asterisk that could be caused by using the PresenceState AMI action while providing an invalid provider. This patch also adds some additional warnings when a user attempts to provide the PresenceState action with invalid data, and removes some NOTICE statements that were still lurking in the code from testing. (closes issue AST-1084) Reported by: John Bigelow Tested by: John Bigelow ........ Merged revisions 381594 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381595 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_presencestate.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/funcs/func_presencestate.c b/funcs/func_presencestate.c
index e62cf7d0d..51df75098 100644
--- a/funcs/func_presencestate.c
+++ b/funcs/func_presencestate.c
@@ -243,7 +243,7 @@ static enum ast_presence_state custom_presence_callback(const char *data, char *
ast_db_get(astdb_family, data, buf, sizeof(buf));
if (parse_data(buf, &state, &_subtype, &_message, &_options)) {
- return -1;
+ return AST_PRESENCE_INVALID;
}
if ((strchr(_options, 'e'))) {
@@ -252,7 +252,6 @@ static enum ast_presence_state custom_presence_callback(const char *data, char *
*subtype = NULL;
} else {
memset(tmp, 0, sizeof(tmp));
- ast_log(LOG_NOTICE, "Hey there, I'm doing some base64 decoding\n");
ast_base64decode((unsigned char *) tmp, _subtype, sizeof(tmp) - 1);
*subtype = ast_strdup(tmp);
}
@@ -261,12 +260,10 @@ static enum ast_presence_state custom_presence_callback(const char *data, char *
*message = NULL;
} else {
memset(tmp, 0, sizeof(tmp));
- ast_log(LOG_NOTICE, "Hey there, I'm doing some more base64 decoding\n");
ast_base64decode((unsigned char *) tmp, _message, sizeof(tmp) - 1);
*message = ast_strdup(tmp);
}
} else {
- ast_log(LOG_NOTICE, "Not doing any base64 decoding\n");
*subtype = ast_strlen_zero(_subtype) ? NULL : ast_strdup(_subtype);
*message = ast_strlen_zero(_message) ? NULL : ast_strdup(_message);
}