summaryrefslogtreecommitdiff
path: root/include/asterisk/json.h
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2015-02-27 18:31:31 +0000
committerRichard Mudgett <rmudgett@digium.com>2015-02-27 18:31:31 +0000
commit9e841e4fb62f072f26f076bd4dd2a8eebe7a9e75 (patch)
treee0040f22d288c44f53089f95868540264a5689fe /include/asterisk/json.h
parentd79670b2694c22ab078e029a6a3b7e066d6ae531 (diff)
ARI: Fix crash if integer values used in JSON payload 'variables' object.
Sending the following ARI commands caused Asterisk to crash if the JSON body 'variables' object passes values of types other than strings. POST /ari/channels POST /ari/channels/{channelid} PUT /ari/endpoints/sendMessage PUT /ari/endpoints/{tech}/{resource}/sendMessage * Eliminated RAII_VAR usage in ast_ari_channels_originate_with_id(), ast_ari_channels_originate(), ast_ari_endpoints_send_message(), and ast_ari_endpoints_send_message_to_endpoint(). ASTERISK-24751 #close Reported by: jeffrey putnam Review: https://reviewboard.asterisk.org/r/4447/ ........ Merged revisions 432404 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432405 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/json.h')
-rw-r--r--include/asterisk/json.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/include/asterisk/json.h b/include/asterisk/json.h
index 8cb74a459..28ebfbd51 100644
--- a/include/asterisk/json.h
+++ b/include/asterisk/json.h
@@ -1010,13 +1010,24 @@ struct ast_party_id;
*/
struct ast_json *ast_json_party_id(struct ast_party_id *party);
+enum ast_json_to_ast_vars_code {
+ /*! \brief Conversion successful */
+ AST_JSON_TO_AST_VARS_CODE_SUCCESS,
+ /*!
+ * \brief Conversion failed because invalid value type supplied.
+ * \note Only string values allowed.
+ */
+ AST_JSON_TO_AST_VARS_CODE_INVALID_TYPE,
+ /*! \brief Conversion failed because of allocation failure. (Out Of Memory) */
+ AST_JSON_TO_AST_VARS_CODE_OOM,
+};
+
/*!
* \brief Convert a \c ast_json list of key/value pair tuples into a \c ast_variable list
* \since 12.5.0
*
* \param json_variables The JSON blob containing the variable
* \param variables An out reference to the variables to populate.
- * The pointer to the variables should be NULL when calling this.
*
* \code
* struct ast_json *json_variables = ast_json_pack("[ { s: s } ]", "foo", "bar");
@@ -1026,10 +1037,9 @@ struct ast_json *ast_json_party_id(struct ast_party_id *party);
* res = ast_json_to_ast_variables(json_variables, &variables);
* \endcode
*
- * \retval 0 success
- * \retval -1 error
+ * \return Conversion enum ast_json_to_ast_vars_code status
*/
-int ast_json_to_ast_variables(struct ast_json *json_variables, struct ast_variable **variables);
+enum ast_json_to_ast_vars_code ast_json_to_ast_variables(struct ast_json *json_variables, struct ast_variable **variables);
/*!@}*/