diff options
author | Robert Pluim <rpluim@gmail.com> | 2020-09-01 16:59:50 +0200 |
---|---|---|
committer | Robert Pluim <rpluim@gmail.com> | 2020-09-01 17:01:48 +0200 |
commit | 2e3ec402938be0d61c19831c12e69a10672dd681 (patch) | |
tree | 593ad003070f199d3b0989f2e34989480edd451b | |
parent | 0996047476e93f036740c630279629a4c2a825c7 (diff) | |
download | emacs-2e3ec402938be0d61c19831c12e69a10672dd681.tar.gz emacs-2e3ec402938be0d61c19831c12e69a10672dd681.tar.bz2 emacs-2e3ec402938be0d61c19831c12e69a10672dd681.zip |
Strip carriage returns from received password prompts (comint)
* comint.el (comint-password-prompt-regexp): Strip carriage
returns from the received prompt before matching. (Bug#43003)
-rw-r--r-- | lisp/comint.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index be0e32b9e09..b4ea232767c 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -2423,11 +2423,13 @@ Security bug: your string can still be temporarily recovered with (defun comint-watch-for-password-prompt (string) "Prompt in the minibuffer for password and send without echoing. Looks for a match to `comint-password-prompt-regexp' in order -to detect the need to (prompt and) send a password. +to detect the need to (prompt and) send a password. Ignores any +carriage returns (\\r) in STRING. This function could be in the list `comint-output-filter-functions'." (when (let ((case-fold-search t)) - (string-match comint-password-prompt-regexp string)) + (string-match comint-password-prompt-regexp + (replace-regexp-in-string "\r" "" string))) (when (string-match "^[ \n\r\t\v\f\b\a]+" string) (setq string (replace-match "" t t string))) (let ((comint--prompt-recursion-depth (1+ comint--prompt-recursion-depth))) |