GNU bug report logs - #3230
dired-actual-switches is risky

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Wed, 6 May 2009 14:25:06 UTC

Severity: normal

Fixed in version 24.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo <sdl.web <at> gmail.com>
Cc: 3230 <at> debbugs.gnu.org, Glenn Morris <rgm <at> gnu.org>
Subject: bug#3230: 23.0.93; Make dired-actual-switches safe local variable?
Date: Thu, 24 Feb 2011 09:57:04 -0500
> (defun dired-actual-switches-p (switches)
>   (and (stringp switches)
>        (catch 'exit
>          (mapc (lambda (switch)
>                  (unless (eq (aref switch 0) ?-)
>                    (throw 'exit nil)))
>                (split-string switches nil t))
>          t)))

Hmm, what about "-l;reboot" ?
BTW, writing a predicate is the right thing to so, and the predicate
should then go to safe-local-variable.  I'd recommend something simple
like

  (defun dired-safe-switches-p (switches)
    (string-match "\\`[- [[:alnum:]]]+\\'" switches))

Hopefully that one is safe (tho maybe we should check string-length to
avoid attacks playing on overflow).  And if it proves too restrictive,
we can make it a bit more permissive once we encounter a particular
example that warrants it.
    

        Stefan




This bug report was last modified 14 years and 81 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.