Merge "Audit ast_json_pack() calls for needed UTF-8 checks."

This commit is contained in:
zuul
2016-10-14 17:17:14 -05:00
committed by Gerrit Code Review
6 changed files with 31 additions and 30 deletions

View File

@@ -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,
enum ast_aoc_currency_multiplier mult)
{
return ast_json_pack("{s:s, s:i, s:s}", "Name", name,
"Cost", cost, "Multiplier", aoc_multiplier_str(mult));
return ast_json_pack("{s:s, s:i, s:s}",
"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)
@@ -1691,9 +1693,8 @@ static struct ast_json *association_to_json(const struct ast_aoc_decoded *decode
{
switch (decoded->charging_association.charging_type) {
case AST_AOC_CHARGING_ASSOCIATION_NUMBER:
return ast_json_pack(
"{s:s, s:i}",
"Number", decoded->charging_association.charge.number.number,
return ast_json_pack("{s:s, s:i}",
"Number", AST_JSON_UTF8_VALIDATE(decoded->charging_association.charge.number.number),
"Plan", decoded->charging_association.charge.number.plan);
case AST_AOC_CHARGING_ASSOCIATION_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.multiplier);
time = ast_json_pack(
"{s:i, s:s}",
time = ast_json_pack("{s:i, s:i}",
"Length", decoded->aoc_s_entries[i].rate.duration.time,
"Scale", decoded->aoc_s_entries[i].rate.duration.time_scale);
if (decoded->aoc_s_entries[i].rate.duration.granularity_time) {
granularity = ast_json_pack(
"{s:i, s:s}",
granularity = ast_json_pack("{s:i, s:i}",
"Length", decoded->aoc_s_entries[i].rate.duration.granularity_time,
"Scale", decoded->aoc_s_entries[i].rate.duration.granularity_time_scale);
}