various modules: json integer overflow

There were still a few places in the code that could overflow when "packing"
a json object with a value outside the base type integer's range. For instance:

unsigned int value = INT_MAX + 1
ast_json_pack("{s: i}", value);

would result in a negative number being "packed". In those situations this patch
alters those values to a ast_json_int_t, which widens the value up to a long or
long long.

ASTERISK-28480

Change-Id: Ied530780d83e6f1772adba0e28d8938ef30c49a1
This commit is contained in:
Kevin Harwell
2019-08-01 16:22:01 -05:00
parent 8de36bfa41
commit 6bb14150c4
10 changed files with 38 additions and 38 deletions

View File

@@ -394,8 +394,8 @@ static void local_optimization_started_cb(struct ast_unreal_pvt *base, struct as
return;
}
json_object = ast_json_pack("{s: i, s: i}",
"dest", dest, "id", id);
json_object = ast_json_pack("{s: i, s: I}",
"dest", dest, "id", (ast_json_int_t)id);
if (!json_object) {
return;
@@ -436,7 +436,7 @@ static void local_optimization_finished_cb(struct ast_unreal_pvt *base, int succ
return;
}
json_object = ast_json_pack("{s: i, s: i}", "success", success, "id", id);
json_object = ast_json_pack("{s: i, s: I}", "success", success, "id", (ast_json_int_t)id);
if (!json_object) {
return;