[Forensics-changes] [yara] 207/407: Check for undefined arguments in hash functions
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:28:26 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 d293513e882771912ebf40d1337a27a9dee5f39c
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Fri Nov 7 15:20:22 2014 +0100
Check for undefined arguments in hash functions
---
libyara/modules/hash.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/libyara/modules/hash.c b/libyara/modules/hash.c
index ae18c3d..625453e 100644
--- a/libyara/modules/hash.c
+++ b/libyara/modules/hash.c
@@ -111,6 +111,9 @@ define_function(data_md5)
int64_t offset = integer_argument(1); // offset where to start
int64_t length = integer_argument(2); // length of bytes we want hash on
+ if (IS_UNDEFINED(offset) || IS_UNDEFINED(length))
+ return_string(UNDEFINED);
+
YR_SCAN_CONTEXT* context = scan_context();
YR_MEMORY_BLOCK* block = NULL;
@@ -170,6 +173,9 @@ define_function(data_sha1)
int64_t offset = integer_argument(1); // offset where to start
int64_t length = integer_argument(2); // length of bytes we want hash on
+ if (IS_UNDEFINED(offset) || IS_UNDEFINED(length))
+ return_string(UNDEFINED);
+
YR_SCAN_CONTEXT* context = scan_context();
YR_MEMORY_BLOCK* block = NULL;
@@ -228,6 +234,9 @@ define_function(data_sha256)
int64_t offset = integer_argument(1); // offset where to start
int64_t length = integer_argument(2); // length of bytes we want hash on
+ if (IS_UNDEFINED(offset) || IS_UNDEFINED(length))
+ return_string(UNDEFINED);
+
YR_SCAN_CONTEXT* context = scan_context();
YR_MEMORY_BLOCK* block = NULL;
@@ -281,8 +290,6 @@ define_function(data_sha256)
}
-
-
begin_declarations;
declare_function("md5", "ii", "s", data_md5);
--
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