[Forensics-changes] [yara] 319/368: Fix potential null dereference issue

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:30:52 UTC 2017


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

bengen pushed a commit to annotated tag v3.5.0
in repository yara.

commit 2470a02b27781fc76b3a8f648394ad09905a55c2
Author: plusvic <plusvic at gmail.com>
Date:   Wed Jun 15 13:30:50 2016 +0200

    Fix potential null dereference issue
---
 libyara/rules.c | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/libyara/rules.c b/libyara/rules.c
index 19080e5..293ed39 100644
--- a/libyara/rules.c
+++ b/libyara/rules.c
@@ -160,22 +160,25 @@ void _yr_rules_clean_matches(
     rule->ns->t_flags[tidx] &= ~NAMESPACE_TFLAGS_UNSATISFIED_GLOBAL;
   }
 
-  string = (YR_STRING**) yr_arena_base_address(
-      context->matching_strings_arena);
-
-  while (string != NULL)
+  if (context->matching_strings_arena != NULL)
   {
-    (*string)->matches[tidx].count = 0;
-    (*string)->matches[tidx].head = NULL;
-    (*string)->matches[tidx].tail = NULL;
-    (*string)->unconfirmed_matches[tidx].count = 0;
-    (*string)->unconfirmed_matches[tidx].head = NULL;
-    (*string)->unconfirmed_matches[tidx].tail = NULL;
-
-    string = (YR_STRING**) yr_arena_next_address(
-        context->matching_strings_arena,
-        string,
-        sizeof(string));
+    string = (YR_STRING**) yr_arena_base_address(
+        context->matching_strings_arena);
+
+    while (string != NULL)
+    {
+      (*string)->matches[tidx].count = 0;
+      (*string)->matches[tidx].head = NULL;
+      (*string)->matches[tidx].tail = NULL;
+      (*string)->unconfirmed_matches[tidx].count = 0;
+      (*string)->unconfirmed_matches[tidx].head = NULL;
+      (*string)->unconfirmed_matches[tidx].tail = NULL;
+
+      string = (YR_STRING**) yr_arena_next_address(
+          context->matching_strings_arena,
+          string,
+          sizeof(YR_STRING*));
+    }
   }
 }
 

-- 
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