mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user