[Forensics-changes] [yara] 106/135: Show appropriate error message when importing an unknown module

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:27:37 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.1.0
in repository yara.

commit 797c485c7bb6e86a45ef32d07136e62e78feaf3d
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Wed Aug 20 13:15:39 2014 +0200

    Show appropriate error message when importing an unknown module
---
 libyara/compiler.c | 7 +++++++
 libyara/parser.c   | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/libyara/compiler.c b/libyara/compiler.c
index 7d3652f..d303e1f 100644
--- a/libyara/compiler.c
+++ b/libyara/compiler.c
@@ -784,6 +784,13 @@ char* yr_compiler_get_error_message(
           buffer_size,
           "'for <quantifier> of <string set>' loops can't be nested");
       break;
+    case ERROR_UNKNOWN_MODULE:
+      snprintf(
+          buffer,
+          buffer_size,
+          "unknown module \"%s\"",
+          compiler->last_error_extra_info);
+      break;
     case ERROR_INTERNAL_FATAL_ERROR:
       snprintf(
           buffer,
diff --git a/libyara/parser.c b/libyara/parser.c
index 9d75470..ec442e0 100644
--- a/libyara/parser.c
+++ b/libyara/parser.c
@@ -856,10 +856,15 @@ int yr_parser_reduce_import(
         module_structure);
 
   if (compiler->last_result == ERROR_SUCCESS)
+  {
     compiler->last_result = yr_modules_do_declarations(
         module_name->c_string,
         module_structure);
 
+    if (compiler->last_result == ERROR_UNKNOWN_MODULE)
+      yr_compiler_set_error_extra_info(compiler, module_name->c_string);
+  }
+
   if (compiler->last_result == ERROR_SUCCESS)
     compiler->last_result = yr_arena_write_string(
         compiler->sz_arena,

-- 
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