From bb50eef3453afbfa040596ff435a0e519842bf42 Mon Sep 17 00:00:00 2001 From: Kevin Lin Date: Fri, 22 May 2015 16:31:24 -0400 Subject: [PATCH] altstr: fixed optimization error with fixed len alternates altstr: consistent conditional applied to byte alternates --- libclamav/matcher-ac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libclamav/matcher-ac.c b/libclamav/matcher-ac.c index 75b88ed00..41517811c 100644 --- a/libclamav/matcher-ac.c +++ b/libclamav/matcher-ac.c @@ -949,11 +949,11 @@ inline static int ac_findmatch_special(const unsigned char *buffer, uint32_t off switch(special->type) { case AC_SPECIAL_ALT_CHAR: /* single-byte */ for (j = 0; j < special->num; j++) { - cmp = (special->alt).byte[j] - b; + cmp = b - (special->alt).byte[j]; if (cmp == 0) { match = !special->negative; break; - } else if (cmp > 0) + } else if (cmp < 0) break; } break; @@ -968,7 +968,7 @@ inline static int ac_findmatch_special(const unsigned char *buffer, uint32_t off if (cmp == 0) { match = (!special->negative) * special->len; break; - } else if (cmp > 0) + } else if (cmp < 0) break; } break;