[Forensics-changes] [yara] 299/415: Fix bug introduced in previous commit. It was trying to free non heap allocated strings.
Hilko Bengen
bengen at moszumanska.debian.org
Thu Apr 3 05:43:17 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 5d7378a1e64d0697058d8730580e597ad0852e12
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Sat Dec 7 18:38:04 2013 +0100
Fix bug introduced in previous commit. It was trying to free non heap allocated strings.
---
libyara/rules.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/libyara/rules.c b/libyara/rules.c
index f40b58d..7141c93 100644
--- a/libyara/rules.c
+++ b/libyara/rules.c
@@ -741,13 +741,19 @@ int yr_rules_define_string_variable(
{
if (strcmp(external->identifier, identifier) == 0)
{
- external->type = EXTERNAL_VARIABLE_TYPE_MALLOC_STRING;
-
- if (external->string != NULL)
+ if (external->type == EXTERNAL_VARIABLE_TYPE_MALLOC_STRING &&
+ external->string != NULL)
+ {
yr_free(external->string);
+ }
+ external->type = EXTERNAL_VARIABLE_TYPE_MALLOC_STRING;
external->string = yr_strdup(value);
- break;
+
+ if (external->string == NULL)
+ return ERROR_INSUFICIENT_MEMORY;
+ else
+ return ERROR_SUCCESS;
}
external++;
--
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