[Forensics-changes] [yara] 118/135: Fix double invocation side-effect when passing a function to return_string() macro, like in return_string(f(...))

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:27:38 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 ac87a92befc088f9f55cc22b72e86c78962d9218
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Fri Aug 22 14:02:54 2014 +0200

    Fix double invocation side-effect when passing a function to return_string() macro, like in return_string(f(...))
---
 libyara/include/yara/modules.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libyara/include/yara/modules.h b/libyara/include/yara/modules.h
index 7aa76d0..6b92364 100644
--- a/libyara/include/yara/modules.h
+++ b/libyara/include/yara/modules.h
@@ -221,8 +221,9 @@ limitations under the License.
       assertf( \
           __function_obj->return_obj->type == OBJECT_TYPE_STRING, \
           "return type differs from function declaration"); \
+      char* s = (char*) (string); \
       yr_object_set_string( \
-          ((string) != (void*) UNDEFINED) ? (string) : NULL, \
+          (s != (char*) UNDEFINED) ? s : NULL, \
           __function_obj->return_obj, \
           NULL); \
       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