mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Merge "Audit ast_json_pack() calls for needed UTF-8 checks."
This commit is contained in:
@@ -263,8 +263,8 @@ static void phase_e_handler(t30_state_t *f, void *user_data, int result)
|
|||||||
ast_json_ref(json_filenames);
|
ast_json_ref(json_filenames);
|
||||||
json_object = ast_json_pack("{s: s, s: s, s: s, s: i, s: i, s: i, s: o}",
|
json_object = ast_json_pack("{s: s, s: s, s: s, s: i, s: i, s: i, s: o}",
|
||||||
"type", s->direction ? "send" : "receive",
|
"type", s->direction ? "send" : "receive",
|
||||||
"remote_station_id", far_ident,
|
"remote_station_id", AST_JSON_UTF8_VALIDATE(far_ident),
|
||||||
"local_station_id", local_ident,
|
"local_station_id", AST_JSON_UTF8_VALIDATE(local_ident),
|
||||||
"fax_pages", pages_transferred,
|
"fax_pages", pages_transferred,
|
||||||
"fax_resolution", stat.y_resolution,
|
"fax_resolution", stat.y_resolution,
|
||||||
"fax_bitrate", stat.bit_rate,
|
"fax_bitrate", stat.bit_rate,
|
||||||
|
@@ -5650,7 +5650,7 @@ static void send_agent_complete(const char *queuename, struct ast_channel_snapsh
|
|||||||
"MemberName", member->membername,
|
"MemberName", member->membername,
|
||||||
"HoldTime", (long)(callstart - holdstart),
|
"HoldTime", (long)(callstart - holdstart),
|
||||||
"TalkTime", (long)(time(NULL) - callstart),
|
"TalkTime", (long)(time(NULL) - callstart),
|
||||||
"Reason", reason);
|
"Reason", reason ?: "");
|
||||||
|
|
||||||
queue_publish_multi_channel_snapshot_blob(ast_queue_topic(queuename), caller, peer,
|
queue_publish_multi_channel_snapshot_blob(ast_queue_topic(queuename), caller, peer,
|
||||||
queue_agent_complete_type(), blob);
|
queue_agent_complete_type(), blob);
|
||||||
|
17
main/aoc.c
17
main/aoc.c
@@ -1656,8 +1656,10 @@ static struct ast_json *units_to_json(const struct ast_aoc_decoded *decoded)
|
|||||||
static struct ast_json *currency_to_json(const char *name, int cost,
|
static struct ast_json *currency_to_json(const char *name, int cost,
|
||||||
enum ast_aoc_currency_multiplier mult)
|
enum ast_aoc_currency_multiplier mult)
|
||||||
{
|
{
|
||||||
return ast_json_pack("{s:s, s:i, s:s}", "Name", name,
|
return ast_json_pack("{s:s, s:i, s:s}",
|
||||||
"Cost", cost, "Multiplier", aoc_multiplier_str(mult));
|
"Name", AST_JSON_UTF8_VALIDATE(name),
|
||||||
|
"Cost", cost,
|
||||||
|
"Multiplier", aoc_multiplier_str(mult));
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_json *charge_to_json(const struct ast_aoc_decoded *decoded)
|
static struct ast_json *charge_to_json(const struct ast_aoc_decoded *decoded)
|
||||||
@@ -1691,9 +1693,8 @@ static struct ast_json *association_to_json(const struct ast_aoc_decoded *decode
|
|||||||
{
|
{
|
||||||
switch (decoded->charging_association.charging_type) {
|
switch (decoded->charging_association.charging_type) {
|
||||||
case AST_AOC_CHARGING_ASSOCIATION_NUMBER:
|
case AST_AOC_CHARGING_ASSOCIATION_NUMBER:
|
||||||
return ast_json_pack(
|
return ast_json_pack("{s:s, s:i}",
|
||||||
"{s:s, s:i}",
|
"Number", AST_JSON_UTF8_VALIDATE(decoded->charging_association.charge.number.number),
|
||||||
"Number", decoded->charging_association.charge.number.number,
|
|
||||||
"Plan", decoded->charging_association.charge.number.plan);
|
"Plan", decoded->charging_association.charge.number.plan);
|
||||||
case AST_AOC_CHARGING_ASSOCIATION_ID:
|
case AST_AOC_CHARGING_ASSOCIATION_ID:
|
||||||
return ast_json_pack("{s:i}", "ID", decoded->charging_association.charge.id);
|
return ast_json_pack("{s:i}", "ID", decoded->charging_association.charge.id);
|
||||||
@@ -1738,14 +1739,12 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
|
|||||||
decoded->aoc_s_entries[i].rate.duration.amount,
|
decoded->aoc_s_entries[i].rate.duration.amount,
|
||||||
decoded->aoc_s_entries[i].rate.duration.multiplier);
|
decoded->aoc_s_entries[i].rate.duration.multiplier);
|
||||||
|
|
||||||
time = ast_json_pack(
|
time = ast_json_pack("{s:i, s:i}",
|
||||||
"{s:i, s:s}",
|
|
||||||
"Length", decoded->aoc_s_entries[i].rate.duration.time,
|
"Length", decoded->aoc_s_entries[i].rate.duration.time,
|
||||||
"Scale", decoded->aoc_s_entries[i].rate.duration.time_scale);
|
"Scale", decoded->aoc_s_entries[i].rate.duration.time_scale);
|
||||||
|
|
||||||
if (decoded->aoc_s_entries[i].rate.duration.granularity_time) {
|
if (decoded->aoc_s_entries[i].rate.duration.granularity_time) {
|
||||||
granularity = ast_json_pack(
|
granularity = ast_json_pack("{s:i, s:i}",
|
||||||
"{s:i, s:s}",
|
|
||||||
"Length", decoded->aoc_s_entries[i].rate.duration.granularity_time,
|
"Length", decoded->aoc_s_entries[i].rate.duration.granularity_time,
|
||||||
"Scale", decoded->aoc_s_entries[i].rate.duration.granularity_time_scale);
|
"Scale", decoded->aoc_s_entries[i].rate.duration.granularity_time_scale);
|
||||||
}
|
}
|
||||||
|
@@ -1237,10 +1237,10 @@ static void cel_parking_cb(
|
|||||||
|
|
||||||
if (parked_payload->retriever) {
|
if (parked_payload->retriever) {
|
||||||
extra = ast_json_pack("{s: s, s: s}",
|
extra = ast_json_pack("{s: s, s: s}",
|
||||||
"reason", reason,
|
"reason", reason ?: "",
|
||||||
"retriever", parked_payload->retriever->name);
|
"retriever", parked_payload->retriever->name);
|
||||||
} else {
|
} else {
|
||||||
extra = ast_json_pack("{s: s}", "reason", reason);
|
extra = ast_json_pack("{s: s}", "reason", reason ?: "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extra) {
|
if (extra) {
|
||||||
|
@@ -1416,9 +1416,11 @@ static int report_fax_status(struct ast_channel *chan, struct ast_fax_session_de
|
|||||||
|
|
||||||
json_object = ast_json_pack("{s: s, s: s, s: s, s: s, s: o}",
|
json_object = ast_json_pack("{s: s, s: s, s: s, s: s, s: o}",
|
||||||
"type", "status",
|
"type", "status",
|
||||||
"operation", (details->caps & AST_FAX_TECH_GATEWAY) ? "gateway" : (details->caps & AST_FAX_TECH_RECEIVE) ? "receive" : "send",
|
"operation", (details->caps & AST_FAX_TECH_GATEWAY)
|
||||||
|
? "gateway"
|
||||||
|
: (details->caps & AST_FAX_TECH_RECEIVE) ? "receive" : "send",
|
||||||
"status", status,
|
"status", status,
|
||||||
"local_station_id", details->localstationid,
|
"local_station_id", AST_JSON_UTF8_VALIDATE(details->localstationid),
|
||||||
"filenames", json_filenames);
|
"filenames", json_filenames);
|
||||||
if (!json_object) {
|
if (!json_object) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@@ -455,7 +455,7 @@ static struct ast_json *channel_dialplan(
|
|||||||
"type", "ChannelDialplan",
|
"type", "ChannelDialplan",
|
||||||
"timestamp", ast_json_timeval(*tv, NULL),
|
"timestamp", ast_json_timeval(*tv, NULL),
|
||||||
"dialplan_app", new_snapshot->appl,
|
"dialplan_app", new_snapshot->appl,
|
||||||
"dialplan_app_data", new_snapshot->data,
|
"dialplan_app_data", AST_JSON_UTF8_VALIDATE(new_snapshot->data),
|
||||||
"channel", json_channel);
|
"channel", json_channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user