Skip to content

Commit

Permalink
Code quality: Refactor layer attributes as scan parameter
Browse files Browse the repository at this point in the history
The current implementation sets a "next layer attributes" flag field
in the scan context. This may introduce bugs if accidentally not cleared
during error handling, causing that attribute to be applied to a
different layer than intended.

This commit resolves that by adding an attribute flag to the major
internal scan functions and removing the "next layer attributes" from
the scan context. This attributes flag shares the same flag fields as
the attributes flag in the new file inspection callback and the flags
are defined in `clamav.h`.
  • Loading branch information
val-ms committed Jun 10, 2022
1 parent 2923301 commit 0cff2a8
Show file tree
Hide file tree
Showing 45 changed files with 298 additions and 275 deletions.
2 changes: 1 addition & 1 deletion libclamav/7z_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ int cli_7unz(cli_ctx *ctx, size_t offset)
cli_dbgmsg("cli_7unz: Saving to %s\n", tmp_name);
if (cli_writen(fd, outBuffer + offset, outSizeProcessed) != outSizeProcessed)
found = CL_EWRITE;
else if ((found = cli_magic_scan_desc(fd, tmp_name, ctx, name)) == CL_VIRUS)
else if (CL_VIRUS == (found = cli_magic_scan_desc(fd, tmp_name, ctx, name, LAYER_ATTRIBUTES_NONE)))
viruses_found++;
close(fd);
if (!ctx->engine->keeptmp && cli_unlink(tmp_name))
Expand Down
3 changes: 2 additions & 1 deletion libclamav/apm.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ int cli_scanapm(cli_ctx *ctx)
apentry.pBlockStart, apentry.pBlockCount, partoff, partsize);

/* send the partition to cli_magic_scan_nested_fmap_type */
ret = cli_magic_scan_nested_fmap_type(ctx->fmap, partoff, partsize, ctx, CL_TYPE_PART_ANY, (const char *)apentry.name);
ret = cli_magic_scan_nested_fmap_type(ctx->fmap, partoff, partsize, ctx, CL_TYPE_PART_ANY,
(const char *)apentry.name, LAYER_ATTRIBUTES_NONE);
if (ret != CL_CLEAN) {
if (SCAN_ALLMATCHES && (ret == CL_VIRUS))
detection = CL_VIRUS;
Expand Down
4 changes: 2 additions & 2 deletions libclamav/autoit.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ static int ea05(cli_ctx *ctx, const uint8_t *base, char *tmpd)
close(i);
return CL_ESEEK;
}
if (cli_magic_scan_desc(i, tempfile, ctx, NULL) == CL_VIRUS) {
if (CL_VIRUS == cli_magic_scan_desc(i, tempfile, ctx, NULL, LAYER_ATTRIBUTES_NONE)) {
if (!SCAN_ALLMATCHES) {
close(i);
if (!ctx->engine->keeptmp)
Expand Down Expand Up @@ -1474,7 +1474,7 @@ static int ea06(cli_ctx *ctx, const uint8_t *base, char *tmpd)
close(i);
return CL_ESEEK;
}
if (cli_magic_scan_desc(i, tempfile, ctx, NULL) == CL_VIRUS) {
if (CL_VIRUS == cli_magic_scan_desc(i, tempfile, ctx, NULL, LAYER_ATTRIBUTES_NONE)) {
if (!SCAN_ALLMATCHES) {
close(i);
if (!ctx->engine->keeptmp)
Expand Down
8 changes: 4 additions & 4 deletions libclamav/binhex.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int cli_binhex(cli_ctx *ctx)
ret = CL_ESEEK;
break;
}
ret = cli_magic_scan_desc(datafd, dname, ctx, NULL);
ret = cli_magic_scan_desc(datafd, dname, ctx, NULL, LAYER_ATTRIBUTES_NONE);
if (ret == CL_VIRUS) break;
}
if (dec_done)
Expand Down Expand Up @@ -168,7 +168,7 @@ int cli_binhex(cli_ctx *ctx)
ret = CL_ESEEK;
break;
}
ret = cli_magic_scan_desc(resfd, rname, ctx, NULL);
ret = cli_magic_scan_desc(resfd, rname, ctx, NULL, LAYER_ATTRIBUTES_NONE);
break;
}
}
Expand All @@ -180,15 +180,15 @@ int cli_binhex(cli_ctx *ctx)
ret = CL_ESEEK;
break;
}
ret = cli_magic_scan_desc(datafd, dname, ctx, NULL);
ret = cli_magic_scan_desc(datafd, dname, ctx, NULL, LAYER_ATTRIBUTES_NONE);
} else if (write_phase == IN_RES) {
cli_dbgmsg("cli_binhex: scanning partially extracted resource fork\n");
if (lseek(resfd, 0, SEEK_SET) == -1) {
cli_dbgmsg("cli_binhex: call to lseek() has failed\n");
ret = CL_ESEEK;
break;
}
ret = cli_magic_scan_desc(resfd, rname, ctx, NULL);
ret = cli_magic_scan_desc(resfd, rname, ctx, NULL, LAYER_ATTRIBUTES_NONE);
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion libclamav/blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ int fileblobScan(const fileblob *fb)
virus_found = 1;
}

rc = cli_magic_scan_desc(fb->fd, fb->fullname, fb->ctx, fb->b.name);
rc = cli_magic_scan_desc(fb->fd, fb->fullname, fb->ctx, fb->b.name, LAYER_ATTRIBUTES_NONE);
if (rc == CL_VIRUS || virus_found != 0) {
cli_dbgmsg("%s is infected\n", fb->fullname);
return CL_VIRUS;
Expand Down
14 changes: 5 additions & 9 deletions libclamav/bytecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,14 @@ static int cli_bytecode_context_reset(struct cli_bc_ctx *ctx)
snprintf(fullname, 1024, "%s" PATHSEP "javascript", ctx->jsnormdir);
fd = open(fullname, O_RDONLY | O_BINARY);
if (fd >= 0) {
// This flag ingested by cli_recursion_stack_push().
cctx->next_layer_attributes |= LAYER_ATTRIBUTES_NORMALIZED;

ret = cli_scan_desc(fd, cctx, CL_TYPE_HTML, 0, NULL, AC_SCAN_VIR, NULL, NULL);
ret = cli_scan_desc(fd, cctx, CL_TYPE_HTML, 0, NULL, AC_SCAN_VIR,
NULL, NULL, LAYER_ATTRIBUTES_NORMALIZED);
if (ret == CL_CLEAN) {
if (lseek(fd, 0, SEEK_SET) == -1)
cli_dbgmsg("cli_bytecode: call to lseek() has failed\n");
else {
// This flag ingested by cli_recursion_stack_push().
cctx->next_layer_attributes |= LAYER_ATTRIBUTES_NORMALIZED;

ret = cli_scan_desc(fd, cctx, CL_TYPE_TEXT_ASCII, 0, NULL, AC_SCAN_VIR, NULL, NULL);
ret = cli_scan_desc(fd, cctx, CL_TYPE_TEXT_ASCII, 0, NULL, AC_SCAN_VIR,
NULL, NULL, LAYER_ATTRIBUTES_NORMALIZED);
}
}
close(fd);
Expand Down Expand Up @@ -2912,7 +2908,7 @@ int cli_bytecode_runhook(cli_ctx *cctx, const struct cl_engine *engine, struct c
lseek(fd, 0, SEEK_SET);
cli_dbgmsg("***** Scanning unpacked file ******\n");

ret = cli_magic_scan_desc(fd, tempfile, cctx, NULL);
ret = cli_magic_scan_desc(fd, tempfile, cctx, NULL, LAYER_ATTRIBUTES_NONE);

if (!cctx->engine->keeptmp)
if (ftruncate(fd, 0) == -1)
Expand Down
2 changes: 1 addition & 1 deletion libclamav/bytecode_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ int32_t cli_bcapi_extract_new(struct cli_bc_ctx *ctx, int32_t id)
cli_dbgmsg("bytecode: scanning extracted file %s\n", ctx->tempfile);
cctx = (cli_ctx *)ctx->ctx;
if (cctx) {
res = cli_magic_scan_desc_type(ctx->outfd, ctx->tempfile, cctx, ctx->containertype, NULL);
res = cli_magic_scan_desc_type(ctx->outfd, ctx->tempfile, cctx, ctx->containertype, NULL, LAYER_ATTRIBUTES_NONE);
if (res == CL_VIRUS) {
ctx->virname = cli_get_last_virus(cctx);
ctx->found = 1;
Expand Down
2 changes: 1 addition & 1 deletion libclamav/clamav.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ extern void cl_engine_set_clcb_pre_cache(struct cl_engine *engine, clcb_pre_cach
/*
* Attributes of each layer in scan.
*/
#define LAYER_ATTRIBUTES_NORMAL 0x0
#define LAYER_ATTRIBUTES_NONE 0x0
#define LAYER_ATTRIBUTES_NORMALIZED 0x1 /** This layer was modified to make matching more generic, reliable. */
#define LAYER_ATTRIBUTES_DECRYPTED 0x2 /** Decryption was used to extract this layer. I.e. had to decrypt some previous layer. */

Expand Down
9 changes: 6 additions & 3 deletions libclamav/cpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ int cli_scancpio_old(cli_ctx *ctx)
if (ret == CL_EMAXFILES) {
goto leave;
} else if (ret == CL_SUCCESS) {
ret = cli_magic_scan_nested_fmap_type(ctx->fmap, pos, filesize, ctx, CL_TYPE_ANY, fmap_name);
ret = cli_magic_scan_nested_fmap_type(ctx->fmap, pos, filesize, ctx, CL_TYPE_ANY,
fmap_name, LAYER_ATTRIBUTES_NONE);
if (ret == CL_VIRUS) {
if (!SCAN_ALLMATCHES)
return ret;
Expand Down Expand Up @@ -259,7 +260,8 @@ int cli_scancpio_odc(cli_ctx *ctx)
if (ret == CL_EMAXFILES) {
goto leave;
} else if (ret == CL_SUCCESS) {
ret = cli_magic_scan_nested_fmap_type(ctx->fmap, pos, filesize, ctx, CL_TYPE_ANY, name);
ret = cli_magic_scan_nested_fmap_type(ctx->fmap, pos, filesize, ctx, CL_TYPE_ANY,
name, LAYER_ATTRIBUTES_NONE);
if (ret == CL_VIRUS) {
if (!SCAN_ALLMATCHES)
return ret;
Expand Down Expand Up @@ -352,7 +354,8 @@ int cli_scancpio_newc(cli_ctx *ctx, int crc)
if (ret == CL_EMAXFILES) {
goto leave;
} else if (ret == CL_SUCCESS) {
ret = cli_magic_scan_nested_fmap_type(ctx->fmap, pos, filesize, ctx, CL_TYPE_ANY, name);
ret = cli_magic_scan_nested_fmap_type(ctx->fmap, pos, filesize, ctx, CL_TYPE_ANY,
name, LAYER_ATTRIBUTES_NONE);
if (ret == CL_VIRUS) {
if (!SCAN_ALLMATCHES)
return ret;
Expand Down
5 changes: 3 additions & 2 deletions libclamav/dmg.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ int cli_scandmg(cli_ctx *ctx)
}

/* scan XML with cli_magic_scan_nested_fmap_type */
ret = cli_magic_scan_nested_fmap_type(ctx->fmap, (size_t)hdr.xmlOffset, (size_t)hdr.xmlLength, ctx, CL_TYPE_ANY, NULL);
ret = cli_magic_scan_nested_fmap_type(ctx->fmap, (size_t)hdr.xmlOffset, (size_t)hdr.xmlLength,
ctx, CL_TYPE_ANY, NULL, LAYER_ATTRIBUTES_NONE);
if (ret != CL_CLEAN) {
cli_dbgmsg("cli_scandmg: retcode from scanning TOC xml: %s\n", cl_strerror(ret));
if (!ctx->engine->keeptmp)
Expand Down Expand Up @@ -1083,7 +1084,7 @@ static int dmg_handle_mish(cli_ctx *ctx, unsigned int mishblocknum, char *dir,
/* If okay so far, scan rebuilt partition */
if (ret == CL_CLEAN) {
/* Have to keep partition typing separate */
ret = cli_magic_scan_desc_type(ofd, outfile, ctx, CL_TYPE_PART_ANY, NULL);
ret = cli_magic_scan_desc_type(ofd, outfile, ctx, CL_TYPE_PART_ANY, NULL, LAYER_ATTRIBUTES_NONE);
}

close(ofd);
Expand Down
2 changes: 1 addition & 1 deletion libclamav/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ int cli_unpackelf(cli_ctx *ctx)
cli_dbgmsg("cli_scanelf: Unpacked and rebuilt executable\n");
lseek(ndesc, 0, SEEK_SET);
cli_dbgmsg("***** Scanning rebuilt ELF file *****\n");
if (cli_magic_scan_desc(ndesc, tempfile, ctx, NULL) == CL_VIRUS) {
if (CL_VIRUS == cli_magic_scan_desc(ndesc, tempfile, ctx, NULL, LAYER_ATTRIBUTES_NONE)) {
close(ndesc);
CLI_TMPUNLK();
free(tempfile);
Expand Down
7 changes: 5 additions & 2 deletions libclamav/gif.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,11 @@ cl_error_t cli_parsegif(cli_ctx *ctx)
// Is there an overlay?
if (offset < map->len) {
cli_dbgmsg("GIF: Found extra data after the end of the GIF data stream: %zu bytes, we'll scan it!\n", map->len - offset);
cl_error_t nested_scan_result = cli_magic_scan_nested_fmap_type(map, offset, map->len - offset, ctx, CL_TYPE_ANY, NULL);
status = nested_scan_result != CL_SUCCESS ? nested_scan_result : status;
cl_error_t nested_scan_result = cli_magic_scan_nested_fmap_type(map, offset, map->len - offset,
ctx, CL_TYPE_ANY, NULL,
LAYER_ATTRIBUTES_NONE);

status = nested_scan_result != CL_SUCCESS ? nested_scan_result : status;
}

done:
Expand Down
4 changes: 3 additions & 1 deletion libclamav/gpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ static int gpt_scan_partitions(cli_ctx *ctx, struct gpt_header hdr, size_t secto
/* send the partition to cli_magic_scan_nested_fmap_type */
part_off = gpe.firstLBA * sectorsize;
part_size = (gpe.lastLBA - gpe.firstLBA + 1) * sectorsize;
ret = cli_magic_scan_nested_fmap_type(ctx->fmap, part_off, part_size, ctx, CL_TYPE_PART_ANY, namestr);

ret = cli_magic_scan_nested_fmap_type(ctx->fmap, part_off, part_size, ctx,
CL_TYPE_PART_ANY, namestr, LAYER_ATTRIBUTES_NONE);
if (NULL != namestr) {
free(namestr);
}
Expand Down
4 changes: 2 additions & 2 deletions libclamav/hfsplus.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ static cl_error_t hfsplus_scanfile(cli_ctx *ctx, hfsPlusVolumeHeader *volHeader,
*filename = tmpname;
} else {
if (ret == CL_CLEAN) {
ret = cli_magic_scan_desc(ofd, tmpname, ctx, orig_filename);
ret = cli_magic_scan_desc(ofd, tmpname, ctx, orig_filename, LAYER_ATTRIBUTES_NONE);
}

if (!ctx->engine->keeptmp) {
Expand Down Expand Up @@ -1319,7 +1319,7 @@ static cl_error_t hfsplus_walk_catalog(cli_ctx *ctx, hfsPlusVolumeHeader *volHea
cli_dbgmsg("hfsplus_walk_catalog: Extracted to %s\n", tmpname);

/* if successful so far, scan the output */
ret = cli_magic_scan_desc(ofd, tmpname, ctx, name_utf8);
ret = cli_magic_scan_desc(ofd, tmpname, ctx, name_utf8, LAYER_ATTRIBUTES_NONE);

if (ret == CL_VIRUS) {
has_alerts = 1;
Expand Down
37 changes: 21 additions & 16 deletions libclamav/hwp.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static cl_error_t decompress_and_callback(cli_ctx *ctx, fmap_t *input, size_t at
ret = cb(cbdata, ofd, tmpname, ctx);
} else {
/* default to scanning what we got */
ret = cli_magic_scan_desc(ofd, tmpname, ctx, NULL);
ret = cli_magic_scan_desc(ofd, tmpname, ctx, NULL, LAYER_ATTRIBUTES_NONE);
}

/* clean-up */
Expand Down Expand Up @@ -293,8 +293,8 @@ cl_error_t cli_scanhwpole2(cli_ctx *ctx)
else
cli_dbgmsg("HWPOLE2: Matched uncompressed prefix and size: %u == %u\n", usize, asize);

return cli_magic_scan_nested_fmap_type(map, 4, 0, ctx, CL_TYPE_ANY, NULL);
// return cli_magic_scan_nested_fmap_type(map, 4, 0, ctx, CL_TYPE_OLE2);
return cli_magic_scan_nested_fmap_type(map, 4, 0, ctx,
CL_TYPE_ANY, NULL, LAYER_ATTRIBUTES_NONE);
}

/*** HWP5 ***/
Expand Down Expand Up @@ -374,7 +374,7 @@ static cl_error_t hwp5_cb(void *cbdata, int fd, const char *filepath, cli_ctx *c
if (fd < 0 || !ctx)
return CL_ENULLARG;

return cli_magic_scan_desc(fd, filepath, ctx, NULL);
return cli_magic_scan_desc(fd, filepath, ctx, NULL, LAYER_ATTRIBUTES_NONE);
}

cl_error_t cli_scanhwp5_stream(cli_ctx *ctx, hwp5_header_t *hwp5, char *name, int fd, const char *filepath)
Expand All @@ -394,7 +394,7 @@ cl_error_t cli_scanhwp5_stream(cli_ctx *ctx, hwp5_header_t *hwp5, char *name, in

if (hwp5->flags & HWP5_PASSWORD) {
cli_dbgmsg("HWP5.x: Password encrypted stream, scanning as-is\n");
return cli_magic_scan_desc(fd, filepath, ctx, name);
return cli_magic_scan_desc(fd, filepath, ctx, name, LAYER_ATTRIBUTES_NONE);
}

if (hwp5->flags & HWP5_COMPRESSED) {
Expand Down Expand Up @@ -437,7 +437,7 @@ cl_error_t cli_scanhwp5_stream(cli_ctx *ctx, hwp5_header_t *hwp5, char *name, in
}

/* normal streams */
return cli_magic_scan_desc(fd, filepath, ctx, name);
return cli_magic_scan_desc(fd, filepath, ctx, name, LAYER_ATTRIBUTES_NONE);
}

/*** HWP3 ***/
Expand Down Expand Up @@ -1642,7 +1642,8 @@ static inline cl_error_t parsehwp3_infoblk_1(cli_ctx *ctx, fmap_t *dmap, size_t
#endif
/* 32 bytes for extra data fields */
if (infolen > 0)
ret = cli_magic_scan_nested_fmap_type(map, *offset + 32, infolen - 32, ctx, CL_TYPE_ANY, NULL);
ret = cli_magic_scan_nested_fmap_type(map, *offset + 32, infolen - 32, ctx,
CL_TYPE_ANY, NULL, LAYER_ATTRIBUTES_NONE);
break;
case 2: /* OLE2 Data */
hwp3_debug("HWP3.x: Information Block[%llu]: TYPE: OLE2 Data\n", infoloc);
Expand All @@ -1651,7 +1652,8 @@ static inline cl_error_t parsehwp3_infoblk_1(cli_ctx *ctx, fmap_t *dmap, size_t
cli_jsonstr(entry, "Type", "OLE2 Data");
#endif
if (infolen > 0)
ret = cli_magic_scan_nested_fmap_type(map, *offset, infolen, ctx, CL_TYPE_ANY, NULL);
ret = cli_magic_scan_nested_fmap_type(map, *offset, infolen, ctx,
CL_TYPE_ANY, NULL, LAYER_ATTRIBUTES_NONE);
break;
case 3: /* Hypertext/Hyperlink Information */
hwp3_debug("HWP3.x: Information Block[%llu]: TYPE: Hypertext/Hyperlink Information\n", infoloc);
Expand Down Expand Up @@ -1679,7 +1681,8 @@ static inline cl_error_t parsehwp3_infoblk_1(cli_ctx *ctx, fmap_t *dmap, size_t
hwp3_debug("HWP3.x: Information Block[%llu]: %d: NAME: %s\n", infoloc, i, field);
#endif
/* scanning macros - TODO - check numbers */
ret = cli_magic_scan_nested_fmap_type(map, *offset + (617 * i) + 288, 325, ctx, CL_TYPE_ANY, NULL);
ret = cli_magic_scan_nested_fmap_type(map, *offset + (617 * i) + 288, 325, ctx,
CL_TYPE_ANY, NULL, LAYER_ATTRIBUTES_NONE);
}
break;
case 4: /* Presentation Information */
Expand Down Expand Up @@ -1716,7 +1719,8 @@ static inline cl_error_t parsehwp3_infoblk_1(cli_ctx *ctx, fmap_t *dmap, size_t
#endif
/* 324 bytes for extra data fields */
if (infolen > 0)
ret = cli_magic_scan_nested_fmap_type(map, *offset + 324, infolen - 324, ctx, CL_TYPE_ANY, NULL);
ret = cli_magic_scan_nested_fmap_type(map, *offset + 324, infolen - 324, ctx,
CL_TYPE_ANY, NULL, LAYER_ATTRIBUTES_NONE);
break;
case 0x100: /* Table Extension */
hwp3_debug("HWP3.x: Information Block[%llu]: TYPE: Table Extension\n", infoloc);
Expand All @@ -1737,7 +1741,8 @@ static inline cl_error_t parsehwp3_infoblk_1(cli_ctx *ctx, fmap_t *dmap, size_t
default:
cli_warnmsg("HWP3.x: Information Block[%llu]: TYPE: UNKNOWN(%u)\n", infoloc, infoid);
if (infolen > 0)
ret = cli_magic_scan_nested_fmap_type(map, *offset, infolen, ctx, CL_TYPE_ANY, NULL);
ret = cli_magic_scan_nested_fmap_type(map, *offset, infolen, ctx,
CL_TYPE_ANY, NULL, LAYER_ATTRIBUTES_NONE);
}

*offset += infolen;
Expand Down Expand Up @@ -1860,8 +1865,8 @@ static cl_error_t hwp3_cb(void *cbdata, int fd, const char *filepath, cli_ctx *c
cl_error_t subret = ret;
size_t dlen = offset - start;

ret = cli_magic_scan_nested_fmap_type(map, start, dlen, ctx, CL_TYPE_ANY, NULL);
// ret = cli_magic_scan_nested_fmap_type(map, 0, 0, ctx, CL_TYPE_ANY);
ret = cli_magic_scan_nested_fmap_type(map, start, dlen, ctx,
CL_TYPE_ANY, NULL, LAYER_ATTRIBUTES_NONE);

if (ret == CL_SUCCESS)
ret = subret;
Expand Down Expand Up @@ -1972,7 +1977,7 @@ static cl_error_t hwpml_scan_cb(void *cbdata, int fd, const char *filepath, cli_
if (fd < 0 || !ctx)
return CL_ENULLARG;

return cli_magic_scan_desc(fd, filepath, ctx, NULL);
return cli_magic_scan_desc(fd, filepath, ctx, NULL, LAYER_ATTRIBUTES_NONE);
}

static cl_error_t hwpml_binary_cb(int fd, const char *filepath, cli_ctx *ctx, int num_attribs, struct attrib_entry *attribs, void *cbdata)
Expand Down Expand Up @@ -2008,7 +2013,7 @@ static cl_error_t hwpml_binary_cb(int fd, const char *filepath, cli_ctx *ctx, in
/* decode the binary data if needed - base64 */
if (enc < 0) {
cli_errmsg("HWPML: Unrecognized encoding method\n");
return cli_magic_scan_desc(fd, filepath, ctx, NULL);
return cli_magic_scan_desc(fd, filepath, ctx, NULL, LAYER_ATTRIBUTES_NONE);
} else if (enc == 1) {
STATBUF statbuf;
fmap_t *input;
Expand Down Expand Up @@ -2040,7 +2045,7 @@ static cl_error_t hwpml_binary_cb(int fd, const char *filepath, cli_ctx *ctx, in
funmap(input);
if (!decoded) {
cli_errmsg("HWPML: Failed to get base64 decode binary data\n");
return cli_magic_scan_desc(fd, filepath, ctx, NULL);
return cli_magic_scan_desc(fd, filepath, ctx, NULL, LAYER_ATTRIBUTES_NONE);
}

/* open file for writing and scanning */
Expand Down
Loading

0 comments on commit 0cff2a8

Please sign in to comment.