diff --git a/lisp/server.el b/lisp/server.el index ca6f9e2448b..d84f17bdfe5 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1202,9 +1202,12 @@ The following commands are accepted by the client: (cl-defun server--process-filter-1 (proc string) (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) - (if (and (string-match "-auth \\([!-~]+\\)\n?" string) + (if (and (string-match "-auth \\([!-~]+\\)[ \n]?" string) (equal (match-string 1 string) (process-get proc :auth-key))) (progn (setq string (substring string (match-end 0)))