Skip to content

Commit 8a1d7f4

Browse files
ragusaaval-ms
authored andcommitted
Use correct comp_count
Previously 2 was hardcoded as as upper bound for loop in cli_bcomp_freemeta. Change to comp_count to avoid going past the end.
1 parent 1c67468 commit 8a1d7f4

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

libclamav/matcher-byte-comp.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -988,15 +988,14 @@ unsigned char *cli_bcomp_normalize_buffer(const unsigned char *buffer, uint32_t
988988
void cli_bcomp_freemeta(struct cli_matcher *root, struct cli_bcomp_meta *bm)
989989
{
990990

991-
int i = 0;
991+
uint32_t i = 0;
992992

993993
if (!root || !bm) {
994994
return;
995995
}
996996

997-
/* can never have more than 2 */
998997
if (bm->comps) {
999-
for (i = 0; i < 2; i++) {
998+
for (i = 0; i < bm->comp_count; i++) {
1000999
if (bm->comps[i]) {
10011000
MPOOL_FREE(root->mempool, bm->comps[i]);
10021001
bm->comps[i] = NULL;

0 commit comments

Comments
 (0)