[Forensics-changes] [yara] 38/407: Fix uninitialized variable warning

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:28:06 UTC 2017


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

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

commit 7a83bd9feb3a7de955d56d4097ed42c14c6b3f65
Author: Victor Manuel Alvarez <vmalvarez at virustotal.com>
Date:   Wed Sep 17 10:59:21 2014 +0200

    Fix uninitialized variable warning
---
 libyara/object.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libyara/object.c b/libyara/object.c
index 9c92c85..dd4f9c8 100644
--- a/libyara/object.c
+++ b/libyara/object.c
@@ -383,12 +383,12 @@ YR_OBJECT* _yr_object_lookup(
   YR_OBJECT* obj = object;
 
   const char* p = pattern;
-  const char* key;
+  const char* key = NULL;
 
   char str[256];
 
   int i;
-  int index;
+  int index = -1;
 
   while (obj != NULL)
   {
@@ -457,10 +457,12 @@ YR_OBJECT* _yr_object_lookup(
       switch(obj->type)
       {
         case OBJECT_TYPE_ARRAY:
+          assert(index != -1);
           obj = yr_object_array_get_item(obj, flags, index);
           break;
 
         case OBJECT_TYPE_DICTIONARY:
+          assert(key != NULL);
           obj = yr_object_dict_get_item(obj, flags, key);
           break;
       }

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