[gimp] tools: do not segfault gimptool with source without extension.



commit 02fc818bf651017d21b81e6fda9497fbdaca4682
Author: Jehan <jehan girinstud io>
Date:   Sun May 27 16:08:06 2018 +0200

    tools: do not segfault gimptool with source without extension.
    
    Since commit 58fa382001, gimptool would accept source files with
    non-standard extensions when using known C or C++ compilers. This would
    include source with no extensions at all.
    When this happens, do not try to set a pointer to a non-existing dot
    separator to '\0'. That obviously segfaults.

 tools/gimptool.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/tools/gimptool.c b/tools/gimptool.c
index 8837de83a5..f9755999a5 100644
--- a/tools/gimptool.c
+++ b/tools/gimptool.c
@@ -498,7 +498,7 @@ do_build_2 (const gchar *cflags,
         }
       else
         {
-          g_printerr ("The source file(%s) doesn't have a \"standard\" C or C++ suffix, "
+          g_printerr ("The source file (%s) doesn't have a \"standard\" C or C++ suffix, "
                       "and the tool failed to confirm the language of the file.\n"
                       "Please be explicit about the language of the file "
                       "by renaming it with one of the suffixes: .c .cc .cpp\n",
@@ -507,7 +507,8 @@ do_build_2 (const gchar *cflags,
         }
     }
 
-  *p = '\0';
+  if (p)
+    *p = '\0';
   q = strrchr (dest_exe, G_DIR_SEPARATOR);
 #ifdef G_OS_WIN32
   {


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