[easytag] Avoid NULL deref in Scan_Rename_File_Prefix_Path()



commit 6d878e8a48fb2bb78c235d90fdce129526060c21
Author: Abhinav <abhijangda hotmail com>
Date:   Wed Apr 9 12:43:00 2014 +0530

    Avoid NULL deref in Scan_Rename_File_Prefix_Path()
    
    Check if the current path is non-empty before trying to use the name of
    the currently-displayed file.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727876
    https://retrace.fedoraproject.org/faf/problems/1641130/

 src/scan_dialog.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/scan_dialog.c b/src/scan_dialog.c
index 7b2c4b4..b9e175f 100644
--- a/src/scan_dialog.c
+++ b/src/scan_dialog.c
@@ -1006,10 +1006,16 @@ Scan_Rename_File_Prefix_Path (void)
     gchar *path_tmp;
     const gchar *combo_text = NULL;
     gchar *combo_tmp;
-    ET_File *ETFile          = ETCore->ETFileDisplayed;
-    gchar *filename_utf8_cur = ((File_Name *)ETFile->FileNameCur->data)->value_utf8;
+    ET_File *ETFile = ETCore->ETFileDisplayed;
+    gchar *filename_utf8_cur;
     gchar *path_utf8_cur;
 
+    if (!ETFile)
+    {
+        return;
+    }
+
+    filename_utf8_cur = ((File_Name *)ETFile->FileNameCur->data)->value_utf8;
 
     // The path to prefix
     path_utf8_cur = g_path_get_dirname(filename_utf8_cur);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]