From: Noam Postavsky Date: Sun, 3 Jul 2016 00:26:35 +0000 (-0400) Subject: Error if --eval arg has text beyond 1 expression X-Git-Tag: emacs-26.0.90~1780 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a90d5e6309c0306d931d398506b242c3eb4f40d7;p=emacs.git Error if --eval arg has text beyond 1 expression * lisp/startup.el (command-line-1): If --eval argument has more data than constitutes a single Lisp expression, signal an error (Bug #23159). --- diff --git a/lisp/startup.el b/lisp/startup.el index 761e69e03b1..fcdc376c5ff 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -2360,7 +2360,14 @@ nil default-directory" name) ((member argi '("-eval" "-execute")) (setq inhibit-startup-screen t) - (eval (read (or argval (pop command-line-args-left))))) + (let* ((str-expr (or argval (pop command-line-args-left))) + (read-data (read-from-string str-expr)) + (expr (car read-data)) + (end (cdr read-data))) + (unless (= end (length str-expr)) + (error "Trailing garbage following expression: %s" + (substring str-expr end))) + (eval expr))) ((member argi '("-L" "-directory")) ;; -L :/foo adds /foo to the _end_ of load-path.