[Forensics-changes] [yara] 249/415: Fix bug causing empty strings matching all regexps

Hilko Bengen bengen at moszumanska.debian.org
Thu Apr 3 05:43:11 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch debian
in repository yara.

commit 56097ce1a567e790a88922de3426a5563f208cb3
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Mon Nov 25 12:41:06 2013 +0100

    Fix bug causing empty strings matching all regexps
---
 libyara/eval.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libyara/eval.c b/libyara/eval.c
index 2f4cfe6..59e329d 100644
--- a/libyara/eval.c
+++ b/libyara/eval.c
@@ -83,6 +83,7 @@ long long evaluate(TERM* term, EVALUATION_CONTEXT* context)
 	unsigned int satisfied;
 	int ovector[3];
 	int rc;
+  int len;
 
     STRING* string;
     STRING* saved_anonymous_string;
@@ -446,10 +447,17 @@ long long evaluate(TERM* term, EVALUATION_CONTEXT* context)
         }
 
     case TERM_TYPE_STRING_MATCH:
+
+        len = strlen(term_string_operation->variable->string);
+
+        if (len == 0)
+            return FALSE;
+
         rc = regex_exec(&(term_string_operation->re),
                         FALSE,
                         term_string_operation->variable->string,
-                        strlen(term_string_operation->variable->string));
+                        len);
+
         return (rc >= 0);
 
 	case TERM_TYPE_STRING_CONTAINS:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list