| ... | ... |
@@ -1603,8 +1603,7 @@ int32_t cli_bcapi_json_get_object(struct cli_bc_ctx *ctx, const int8_t* name, in |
| 1603 | 1603 |
strncpy(namep, (char*)name, name_len); |
| 1604 | 1604 |
namep[name_len] = '\0'; |
| 1605 | 1605 |
|
| 1606 |
- jobj = json_object_object_get(jobj,namep); |
|
| 1607 |
- if (!jobj) { /* object not found */
|
|
| 1606 |
+ if (!json_object_object_get_ex(jobj, namep, &jobj)) { /* object not found */
|
|
| 1608 | 1607 |
free(namep); |
| 1609 | 1608 |
return 0; |
| 1610 | 1609 |
} |
| ... | ... |
@@ -700,7 +700,7 @@ ole2_walk_property_tree(ole2_header_t * hdr, const char *dir, int32_t prop_index |
| 700 | 700 |
if (dir) {
|
| 701 | 701 |
#if HAVE_JSON |
| 702 | 702 |
if ((ctx->options & CL_SCAN_FILE_PROPERTIES) && (ctx->wrkproperty != NULL)) {
|
| 703 |
- if (json_object_object_get(ctx->wrkproperty, "DigitalSignatures") == NULL) {
|
|
| 703 |
+ if (!json_object_object_get_ex(ctx->wrkproperty, "DigitalSignatures", NULL)) {
|
|
| 704 | 704 |
name = get_property_name2(prop_block[idx].name, prop_block[idx].name_size); |
| 705 | 705 |
if (name) {
|
| 706 | 706 |
if (!strcmp(name, "_xmlsignatures") || !strcmp(name, "_signatures")) {
|
| ... | ... |
@@ -894,8 +894,7 @@ handler_enum(ole2_header_t * hdr, property_t * prop, const char *dir, cli_ctx * |
| 894 | 894 |
name = get_property_name2(prop->name, prop->name_size); |
| 895 | 895 |
if (name) {
|
| 896 | 896 |
if (ctx->options & CL_SCAN_FILE_PROPERTIES && ctx->wrkproperty != NULL) {
|
| 897 |
- arrobj = json_object_object_get(ctx->wrkproperty, "Streams"); |
|
| 898 |
- if (NULL == arrobj) {
|
|
| 897 |
+ if (!json_object_object_get_ex(ctx->wrkproperty, "Streams", &arrobj)) {
|
|
| 899 | 898 |
arrobj = json_object_new_array(); |
| 900 | 899 |
if (NULL == arrobj) {
|
| 901 | 900 |
cli_errmsg("ole2: no memory for streams list as json array\n");
|
| ... | ... |
@@ -234,8 +234,7 @@ static int ooxml_parse_element(xmlTextReaderPtr reader, json_object *wrkptr, int |
| 234 | 234 |
switch (node_type) {
|
| 235 | 235 |
case XML_READER_TYPE_ELEMENT: |
| 236 | 236 |
if (!skip) {
|
| 237 |
- njptr = json_object_object_get(wrkptr, element_tag); |
|
| 238 |
- if (!njptr) {
|
|
| 237 |
+ if (!json_object_object_get_ex(wrkptr, element_tag, &njptr)) {
|
|
| 239 | 238 |
njptr = json_object_new_object(); |
| 240 | 239 |
if (NULL == njptr) {
|
| 241 | 240 |
cli_errmsg("ooxml_basic_json: no memory for json object.\n");
|
| ... | ... |
@@ -282,8 +281,7 @@ static int ooxml_parse_element(xmlTextReaderPtr reader, json_object *wrkptr, int |
| 282 | 282 |
case XML_READER_TYPE_TEXT: |
| 283 | 283 |
if (!skip) {
|
| 284 | 284 |
node_value = xmlTextReaderConstValue(reader); |
| 285 |
- njptr = json_object_object_get(wrkptr, element_tag); |
|
| 286 |
- if (njptr) {
|
|
| 285 |
+ if (json_object_object_get_ex(wrkptr, element_tag, &njptr)) {
|
|
| 287 | 286 |
cli_warnmsg("ooxml_parse_element: json object [%s] already exists\n", element_tag);
|
| 288 | 287 |
} |
| 289 | 288 |
|
| ... | ... |
@@ -392,8 +390,8 @@ static int ooxml_basic_json(int fd, cli_ctx *ctx, const char *key) |
| 392 | 392 |
if (rlvl > 2) { /* 0 is root xml object */
|
| 393 | 393 |
int i; |
| 394 | 394 |
for (i = 1; i < rlvl-1; ++i) {
|
| 395 |
- json_object *newptr = json_object_object_get(wrkptr, stack[i]); |
|
| 396 |
- if (!newptr) {
|
|
| 395 |
+ json_object *newptr; |
|
| 396 |
+ if (!json_object_object_get_ex(wrkptr, stack[i], &newptr)) {
|
|
| 397 | 397 |
newptr = json_object_new_object(); |
| 398 | 398 |
if (NULL == newptr) {
|
| 399 | 399 |
cli_errmsg("ooxml_basic_json: no memory for json object.\n");
|
| ... | ... |
@@ -996,8 +996,7 @@ void cli_append_virus(cli_ctx * ctx, const char * virname) |
| 996 | 996 |
#if HAVE_JSON |
| 997 | 997 |
if (SCAN_PROPERTIES && ctx->wrkproperty) {
|
| 998 | 998 |
json_object *arrobj, *virobj; |
| 999 |
- arrobj = json_object_object_get(ctx->wrkproperty, "Viruses"); |
|
| 1000 |
- if (NULL == arrobj) {
|
|
| 999 |
+ if (!json_object_object_get_ex(ctx->wrkproperty, "Viruses", &arrobj)) {
|
|
| 1001 | 1000 |
arrobj = json_object_new_array(); |
| 1002 | 1001 |
if (NULL == arrobj) {
|
| 1003 | 1002 |
cli_errmsg("cli_append_virus: no memory for json virus array\n");
|
| ... | ... |
@@ -612,8 +612,7 @@ static struct json_object *get_pe_property(cli_ctx *ctx) |
| 612 | 612 |
if (!(ctx) || !(ctx->wrkproperty)) |
| 613 | 613 |
return NULL; |
| 614 | 614 |
|
| 615 |
- pe = json_object_object_get(ctx->wrkproperty, "PE"); |
|
| 616 |
- if (!(pe)) {
|
|
| 615 |
+ if (!json_object_object_get_ex(ctx->wrkproperty, "PE", &pe)) {
|
|
| 617 | 616 |
pe = json_object_new_object(); |
| 618 | 617 |
if (!(pe)) |
| 619 | 618 |
return NULL; |
| ... | ... |
@@ -634,8 +633,7 @@ static void pe_add_heuristic_property(cli_ctx *ctx, const char *key) |
| 634 | 634 |
if (!(pe)) |
| 635 | 635 |
return; |
| 636 | 636 |
|
| 637 |
- heuristics = json_object_object_get(pe, "Heuristics"); |
|
| 638 |
- if (!(heuristics)) {
|
|
| 637 |
+ if (!json_object_object_get_ex(pe, "Heuristics", &heuristics)) {
|
|
| 639 | 638 |
heuristics = json_object_new_array(); |
| 640 | 639 |
if (!(heuristics)) |
| 641 | 640 |
return; |
| ... | ... |
@@ -659,8 +657,7 @@ static struct json_object *get_section_json(cli_ctx *ctx) |
| 659 | 659 |
if (!(pe)) |
| 660 | 660 |
return NULL; |
| 661 | 661 |
|
| 662 |
- section = json_object_object_get(pe, "Sections"); |
|
| 663 |
- if (!(section)) {
|
|
| 662 |
+ if (!json_object_object_get_ex(pe, "Sections", §ion)) {
|
|
| 664 | 663 |
section = json_object_new_array(); |
| 665 | 664 |
if (!(section)) |
| 666 | 665 |
return NULL; |
| ... | ... |
@@ -2601,8 +2601,7 @@ static int magic_scandesc(cli_ctx *ctx, cli_file_t type) |
| 2601 | 2601 |
} |
| 2602 | 2602 |
else {
|
| 2603 | 2603 |
parent_property = ctx->wrkproperty; |
| 2604 |
- arrobj = json_object_object_get(parent_property, "ContainedObjects"); |
|
| 2605 |
- if (NULL == arrobj) {
|
|
| 2604 |
+ if (!json_object_object_get_ex(parent_property, "ContainedObjects", &arrobj)) {
|
|
| 2606 | 2605 |
arrobj = json_object_new_array(); |
| 2607 | 2606 |
if (NULL == arrobj) {
|
| 2608 | 2607 |
cli_errmsg("magic_scandesc: no memory for json properties object\n");
|