diff options
author | Noam Postavsky <npostavs@gmail.com> | 2016-07-02 20:26:35 -0400 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2016-08-06 16:16:02 -0400 |
commit | a90d5e6309c0306d931d398506b242c3eb4f40d7 (patch) | |
tree | 2bc1f94f5e0d24cd1ca31a2e90e1fd7b5df78757 /lisp/startup.el | |
parent | 4dec928691d91e8c46ca56ebda5b17a806aa076b (diff) | |
download | emacs-a90d5e6309c0306d931d398506b242c3eb4f40d7.tar.gz |
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).
Diffstat (limited to 'lisp/startup.el')
-rw-r--r-- | lisp/startup.el | 9 |
1 files changed, 8 insertions, 1 deletions
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. |