1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 14:30:50 -08:00

server--process-filter-1: Fix stripping -auth argument (bug#79889)

* lisp/server.el (server--process-filter-1): Strip trailing
space after -auth argument (bug#79889).  Fix due to Richard
Copley <rcopley@gmail.com>.
This commit is contained in:
Sean Whitton 2025-11-30 11:24:32 +00:00
parent b208b08371
commit 7d2e22843f

View file

@ -1202,9 +1202,12 @@ The following commands are accepted by the client:
(cl-defun server--process-filter-1 (proc string) (cl-defun server--process-filter-1 (proc string)
(server-log (concat "Received " string) proc) (server-log (concat "Received " string) proc)
;; First things first: let's check the authentication ;; First things first: let's check the authentication.
;; It is important that we strip the trailing space or newline
;; character in order that it does not appear, to the code below,
;; there there is a zero-length argument there (bug#79889).
(unless (process-get proc :authenticated) (unless (process-get proc :authenticated)
(if (and (string-match "-auth \\([!-~]+\\)\n?" string) (if (and (string-match "-auth \\([!-~]+\\)[ \n]?" string)
(equal (match-string 1 string) (process-get proc :auth-key))) (equal (match-string 1 string) (process-get proc :auth-key)))
(progn (progn
(setq string (substring string (match-end 0))) (setq string (substring string (match-end 0)))