Skip to content

Commit

Permalink
Fix bug with logical signature Intermediates feature
Browse files Browse the repository at this point in the history
The file type check for the logical signature Intermediates feature is
off-by-one and so the first layer checked is supposed to be the first
parent of the current layer, but is in fact the current layer.

This commit fixes the issue by correctly checking starting at -2 instead
of -1. (-1 is the current layer, 0 is the outermost layer).
  • Loading branch information
micahsnyder committed Jul 26, 2022
1 parent cf39236 commit 8c8f77a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libclamav/matcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,9 @@ cl_error_t cli_scan_desc(int desc, cli_ctx *ctx, cli_file_t ftype, uint8_t ftonl
static int intermediates_eval(cli_ctx *ctx, struct cli_ac_lsig *ac_lsig)
{
uint32_t i, icnt = ac_lsig->tdb.intermediates[0];
int32_t j = -1;

// -1 is the deepest layer (the current layer), so we start at -2, which is the first ancestor
int32_t j = -2;

if (ctx->recursion_level < icnt)
return 0;
Expand Down

0 comments on commit 8c8f77a

Please sign in to comment.