[Forensics-changes] [yara] 354/368: Fix issue with boolean external variables being defined as integer
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:30:57 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 a5f86fd365ac85e9af4e66b371b6b20117986e57
Author: plusvic <plusvic at gmail.com>
Date: Thu Jun 30 09:43:26 2016 +0200
Fix issue with boolean external variables being defined as integer
---
libyara/compiler.c | 36 +++++++++++++++++++++++++++++++++---
1 file changed, 33 insertions(+), 3 deletions(-)
diff --git a/libyara/compiler.c b/libyara/compiler.c
index 060d81a..dd4c251 100644
--- a/libyara/compiler.c
+++ b/libyara/compiler.c
@@ -651,10 +651,40 @@ YR_API int yr_compiler_define_boolean_variable(
const char* identifier,
int value)
{
- return yr_compiler_define_integer_variable(
- compiler,
+ YR_EXTERNAL_VARIABLE* external;
+ YR_OBJECT* object;
+
+ char* id;
+
+ compiler->last_result = ERROR_SUCCESS;
+
+ FAIL_ON_COMPILER_ERROR(yr_arena_write_string(
+ compiler->sz_arena,
identifier,
- value);
+ &id));
+
+ FAIL_ON_COMPILER_ERROR(yr_arena_allocate_struct(
+ compiler->externals_arena,
+ sizeof(YR_EXTERNAL_VARIABLE),
+ (void**) &external,
+ offsetof(YR_EXTERNAL_VARIABLE, identifier),
+ EOL));
+
+ external->type = EXTERNAL_VARIABLE_TYPE_BOOLEAN;
+ external->identifier = id;
+ external->value.i = value;
+
+ FAIL_ON_COMPILER_ERROR(yr_object_from_external_variable(
+ external,
+ &object));
+
+ FAIL_ON_COMPILER_ERROR(yr_hash_table_add(
+ compiler->objects_table,
+ external->identifier,
+ NULL,
+ (void*) object));
+
+ return ERROR_SUCCESS;
}
--
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