From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: dont load .gdbinit if it is world writable
Date: Sun, 04 Mar 2007 23:08:00 -0000 [thread overview]
Message-ID: <200703041808.04010.vapier@gentoo.org> (raw)
[-- 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++)
next reply other threads:[~2007-03-04 23:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-04 23:08 Mike Frysinger [this message]
2007-03-05 1:45 ` Daniel Jacobowitz
2007-03-05 2:38 ` Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200703041808.04010.vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox