From 7d2e22843f7cf7a4c5f2bbaef3209f2bbb00ca6c Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 30 Nov 2025 11:24:32 +0000 Subject: [PATCH] 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 . --- lisp/server.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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)))