initial import
[patches.git] / gdb-dont-load-world-writable-gdbinit.patch
CommitLineData
5e993f12 12007-03-04 Mike Frysinger <vapier@gentoo.org>
2
3 * main.c: Check if .gdbinit is world writable.
4
5--- main.c 9 Jan 2007 21:34:29 -0000 1.62
6+++ main.c 4 Mar 2007 22:59:00 -0000
7@@ -763,7 +763,14 @@ extern int gdbtk_test (char *);
8 || memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat)))
9 if (!inhibit_gdbinit)
10 {
11- catch_command_errors (source_script, gdbinit, 0, RETURN_MASK_ALL);
12+ if (cwdbuf.st_mode & S_IWOTH)
13+ {
14+ warning (_("Refusing to load world writable gdbinit `%s'.\n"), gdbinit);
15+ }
16+ else
17+ {
18+ catch_command_errors (source_script, gdbinit, 0, RETURN_MASK_ALL);
19+ }
20 }
21
22 for (i = 0; i < ncmd; i++)