Skip to content

Commit

Permalink
blah
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusaa committed Jul 20, 2024
1 parent 961702a commit 41b0446
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions libclamav/ole2_extract_images.h
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ static void saveImageFile( cli_ctx * ctx, const uint8_t * const ptr, size_t size
cl_error_t ret ;
size_t bytesWritten = 0;
FILE * fp = NULL;
static json_object * ary = NULL;

if ((ret = cli_gentempfd_with_prefix(ctx->sub_tmpdir, "ole2_images", &tempfile, &out_fd)) != CL_SUCCESS) {
cli_dbgmsg("[ole2_process_image_directory] Failed to open output file descriptor\n");
Expand All @@ -626,6 +627,16 @@ static void saveImageFile( cli_ctx * ctx, const uint8_t * const ptr, size_t size
cli_dbgmsg("ERROR unable to write to '%s'\n", tempfile);
}

if (SCAN_COLLECT_METADATA && ctx->wrkproperty != NULL){
if (NULL == ary) {
#define OLE2_EXTRACTED_IMAGES_JSON_KEY "OLE2_IMAGES"
ary = cli_jsonarray(ctx->wrkproperty, OLE2_EXTRACTED_IMAGES_JSON_KEY);
}
if (ary) {
cli_jsonstr(ary, NULL, tempfile);
}
}

done:
if (tempfile && !ctx->engine->keeptmp) {
remove(tempfile);
Expand Down

0 comments on commit 41b0446

Please sign in to comment.