[Forensics-changes] [yara] 141/415: Fix issue 39
Hilko Bengen
bengen at moszumanska.debian.org
Thu Apr 3 05:42:56 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 8e7d4598b9fa00b9527f086eef6655c85ed44429
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Wed Aug 15 15:32:26 2012 +0000
Fix issue 39
---
libyara/scan.c | 67 ++++++++++++++++++++++++----------------------------------
1 file changed, 28 insertions(+), 39 deletions(-)
diff --git a/libyara/scan.c b/libyara/scan.c
index 86289a1..6afc766 100644
--- a/libyara/scan.c
+++ b/libyara/scan.c
@@ -793,49 +793,38 @@ inline int find_matches_for_strings( STRING_LIST_ENTRY* first_string,
continue;
}
- if ( (string->flags & flags) && (len = string_match(buffer, buffer_size, string, flags, negative_size)))
- {
- /*
- If this string already matched we must check that this match is not
- overlapping a previous one. This can occur for example if we search
- for the string 'aa' and the file contains 'aaaaaa'.
- */
-
- if ((string->matches_tail == NULL) ||
- (string->matches_tail->offset + string->matches_tail->length <= current_offset))
- {
- string->flags |= STRING_FLAGS_FOUND;
- match = (MATCH*) yr_malloc(sizeof(MATCH));
- match->data = (unsigned char*) yr_malloc(len);
-
- if (match != NULL && match->data != NULL)
+ if ((string->flags & flags) && (len = string_match(buffer, buffer_size, string, flags, negative_size)))
+ {
+ string->flags |= STRING_FLAGS_FOUND;
+ match = (MATCH*) yr_malloc(sizeof(MATCH));
+ match->data = (unsigned char*) yr_malloc(len);
+
+ if (match != NULL && match->data != NULL)
+ {
+ match->offset = current_offset;
+ match->length = len;
+ match->next = NULL;
+
+ memcpy(match->data, buffer, len);
+
+ if (string->matches_head == NULL)
{
- match->offset = current_offset;
- match->length = len;
- match->next = NULL;
-
- memcpy(match->data, buffer, len);
-
- if (string->matches_head == NULL)
- {
- string->matches_head = match;
- }
-
- if (string->matches_tail != NULL)
- {
- string->matches_tail->next = match;
- }
-
- string->matches_tail = match;
-
+ string->matches_head = match;
}
- else
+
+ if (string->matches_tail != NULL)
{
- if (match != NULL)
- yr_free(match);
-
- return ERROR_INSUFICIENT_MEMORY;
+ string->matches_tail->next = match;
}
+
+ string->matches_tail = match;
+ }
+ else
+ {
+ if (match != NULL)
+ yr_free(match);
+
+ return ERROR_INSUFICIENT_MEMORY;
}
}
}
--
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