From 16ec6d8dc18d7a35b7b38cdc83832a0e07f8452d Mon Sep 17 00:00:00 2001 From: Kevin Lin Date: Mon, 9 Mar 2015 18:02:17 -0400 Subject: [PATCH] fullword modifier on regex changed to be closer to yara --- libclamav/readdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libclamav/readdb.c b/libclamav/readdb.c index d12cdd239..183b5b0e8 100644 --- a/libclamav/readdb.c +++ b/libclamav/readdb.c @@ -141,7 +141,7 @@ static int sigopts_handler(struct cli_matcher *root, const char *virname, const if (start != end) { /* FULLWORD regex sigopt handling */ if (sigopts & ACPATT_OPTION_FULLWORD) { - size_t ovrlen = strlen(hexcpy)+5; + size_t ovrlen = strlen(hexcpy)+21; char *hexovr = cli_calloc(ovrlen, sizeof(char)); if (!hexovr) { free(hexcpy); @@ -151,7 +151,7 @@ static int sigopts_handler(struct cli_matcher *root, const char *virname, const *start++ = '\0'; *end++ = '\0'; - snprintf(hexovr, ovrlen, "%s/\\W%s\\W/%s", hexcpy, start, end); + snprintf(hexovr, ovrlen, "%s/([\\W_]|\\A)%s([\\W_]|\\Z)/%s", hexcpy, start, end); free(hexcpy); hexcpy = hexovr;