Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* dont load .gdbinit if it is world writable
@ 2007-03-04 23:08 Mike Frysinger
  2007-03-05  1:45 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2007-03-04 23:08 UTC (permalink / raw)
  To: gdb-patches


[-- Attachment #1.1: Type: text/plain, Size: 473 bytes --]

attached patch checks to see if the $PWD/.gdbinit file is world writable and 
if so, warn about this and refuse to load it

idea being that since you can execute just about anything in it, you dont want 
random people inserting this in it

of course, the usefulness of this is marginalized if .gdbinit is owned by a 
diff user and they just make it world readable but not world writable ... but 
i dont think a cwdbuf.st_uid == getuid() would be accepted ?
-mike

[-- Attachment #1.2: Type: application/pgp-signature, Size: 827 bytes --]

[-- Attachment #2: gdb-dont-load-world-writable-gdbinit.patch --]
[-- Type: text/x-diff, Size: 691 bytes --]

2007-03-04  Mike Frysinger  <vapier@gentoo.org>

	* main.c: Check if .gdbinit is world writable.

--- main.c	9 Jan 2007 21:34:29 -0000	1.62
+++ main.c	4 Mar 2007 22:59:00 -0000
@@ -763,7 +763,14 @@ extern int gdbtk_test (char *);
       || memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat)))
     if (!inhibit_gdbinit)
       {
-	catch_command_errors (source_script, gdbinit, 0, RETURN_MASK_ALL);
+	if (cwdbuf.st_mode & S_IWOTH)
+	  {
+	    warning (_("Refusing to load world writable gdbinit `%s'.\n"), gdbinit);
+	  }
+	else
+	  {
+	    catch_command_errors (source_script, gdbinit, 0, RETURN_MASK_ALL);
+	  }
       }
 
   for (i = 0; i < ncmd; i++)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-03-05  2:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-04 23:08 dont load .gdbinit if it is world writable Mike Frysinger
2007-03-05  1:45 ` Daniel Jacobowitz
2007-03-05  2:38   ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox