SF.net SVN: geany: [1239] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Feb 1 14:42:26 UTC 2007


Revision: 1239
          http://svn.sourceforge.net/geany/?rev=1239&view=rev
Author:   eht16
Date:     2007-02-01 06:42:25 -0800 (Thu, 01 Feb 2007)

Log Message:
-----------
Prevent compiling or executing of files without a filename extension(closes #1642029).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/build.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-01-31 16:06:13 UTC (rev 1238)
+++ trunk/ChangeLog	2007-02-01 14:42:25 UTC (rev 1239)
@@ -1,3 +1,9 @@
+2007-02-01  Enrico Tröger  <enrico.troeger at uvena.de>
+
+ * src/build.c: Prevent compiling or executing of files without a
+                filename extension(closes #1642029).
+
+
 2007-01-31  Enrico Tröger  <enrico.troeger at uvena.de>
 
  * scintilla/ScintillaGTK.cxx, src/document.c, src/document.h,

Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c	2007-01-31 16:06:13 UTC (rev 1238)
+++ trunk/src/build.c	2007-02-01 14:42:25 UTC (rev 1239)
@@ -389,7 +389,7 @@
 static GPid build_spawn_cmd(gint idx, gchar **cmd)
 {
 	GError  *error = NULL;
-	gchar **argv;
+	gchar  **argv;
 	gchar	*working_dir;
 	gchar	*utf8_working_dir;
 	gchar	*cmd_string;
@@ -400,7 +400,7 @@
 	gint     stdout_fd;
 	gint     stderr_fd;
 
-	g_return_val_if_fail(idx >= 0 && doc_list[idx].is_valid, (GPid) 1);
+	g_return_val_if_fail(DOC_IDX_VALID(idx), (GPid) 1);
 
 	document_clear_indicators(idx);
 
@@ -411,6 +411,14 @@
 
 	executable = utils_remove_ext_from_filename(locale_filename);
 
+	// check for filename extension and abort if filename doesn't have one
+	if (utils_str_equal(locale_filename, executable))
+	{
+		msgwin_status_add(_("Command stopped because the current file has no extension."));
+		utils_beep();
+		return (GPid) 1;
+	}
+
 	// replace %f and %e in the command string
 	tmp = g_path_get_basename(locale_filename);
 	cmd_string = utils_str_replace(cmd_string, "%f", tmp);
@@ -530,6 +538,14 @@
 		else
 			check_executable = g_strdup(long_executable);
 
+		// check for filename extension and abort if filename doesn't have one
+		if (utils_str_equal(locale_filename, check_executable))
+		{
+			msgwin_status_add(_("Command stopped because the current file has no extension."));
+			utils_beep();
+			return (GPid) 1;
+		}
+
 		// check whether executable exists
 		if (stat(check_executable, &st) != 0)
 		{


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list