[Forensics-changes] [yara] 322/368: Fix null pointer dereference
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:30:53 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 370aec0a53df0f645bd45aa424df8f9921260b83
Author: plusvic <plusvic at gmail.com>
Date: Wed Jun 15 14:18:58 2016 +0200
Fix null pointer dereference
---
libyara/hash.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libyara/hash.c b/libyara/hash.c
index 3f8285b..7fcb793 100644
--- a/libyara/hash.c
+++ b/libyara/hash.c
@@ -170,17 +170,17 @@ YR_API void* yr_hash_table_lookup(
bucket_index = hash(bucket_index, (uint8_t*) ns, strlen(ns));
bucket_index = bucket_index % table->size;
-
entry = table->buckets[bucket_index];
while (entry != NULL)
{
- if (strcmp(entry->key, key) == 0 &&
- (entry->ns == ns ||
- strcmp(entry->ns, ns) == 0))
- {
+ int key_match = strcmp(entry->key, key) == 0;
+ int ns_match = (
+ (entry->ns == ns) ||
+ (entry->ns != NULL && ns != NULL && strcmp(entry->ns, ns) == 0));
+
+ if (key_match && ns_match)
return entry->value;
- }
entry = entry->next;
}
--
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