[Forensics-changes] [yara] 122/415: Fix segmentation fault trying to close null file descriptor
    Hilko Bengen 
    bengen at moszumanska.debian.org
       
    Thu Apr  3 05:42:53 UTC 2014
    
    
  
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch debian
in repository yara.
commit c65f0f2c30b39c4ccc7952d59cccaf0e46b160be
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Mon Apr 23 16:16:37 2012 +0000
    Fix segmentation fault trying to close null file descriptor
---
 libyara/lex.c | 14 +++++++-------
 libyara/lex.l | 11 +++++++----
 2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/libyara/lex.c b/libyara/lex.c
index 9ae5d22..7b37085 100644
--- a/libyara/lex.c
+++ b/libyara/lex.c
@@ -1351,14 +1351,14 @@ case YY_STATE_EOF(include):
 #line 212 "lex.l"
 {
                                          YARA_CONTEXT* context = yyget_extra(yyscanner);
-					
-										
+				                         FILE* file = yr_pop_file(context);
+				                         
+				                         if (file != NULL)
+				                         {
+				                            fclose(file);
+				                         }
+				                         
                                          yr_pop_file_name(context);
-										
-										 fclose(yr_pop_file(context));
-										
-										
-
                                          yypop_buffer_state(yyscanner);
 
                                          if (!YY_CURRENT_BUFFER)
diff --git a/libyara/lex.l b/libyara/lex.l
index 5d66da9..10caa27 100644
--- a/libyara/lex.l
+++ b/libyara/lex.l
@@ -211,11 +211,14 @@ include[ \t]+\"                      {
 
 <<EOF>>                              {
                                          YARA_CONTEXT* context = yyget_extra(yyscanner);
-				
+				                         FILE* file = yr_pop_file(context);
+				                         
+				                         if (file != NULL)
+				                         {
+				                            fclose(file);
+				                         }
+				                         
                                          yr_pop_file_name(context);
-										 
-										 fclose(yr_pop_file(context));						
-
                                          yypop_buffer_state(yyscanner);
 
                                          if (!YY_CURRENT_BUFFER)
-- 
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