Prevent compiling or executing of files without a filename extension(closes #1642029).
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1239 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
83170ef1cb
commit
8481a9a8c5
@ -1,3 +1,9 @@
|
||||
2007-02-01 Enrico Tröger <enrico.troeger@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@uvena.de>
|
||||
|
||||
* scintilla/ScintillaGTK.cxx, src/document.c, src/document.h,
|
||||
|
20
src/build.c
20
src/build.c
@ -389,7 +389,7 @@ GPid build_link_file(gint idx)
|
||||
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 @@ static GPid build_spawn_cmd(gint idx, gchar **cmd)
|
||||
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 @@ static GPid build_spawn_cmd(gint idx, gchar **cmd)
|
||||
|
||||
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 @@ GPid build_run_cmd(gint idx)
|
||||
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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user