Commit bd1d6175 authored by Basil L. Contovounesios's avatar Basil L. Contovounesios Committed by Eli Zaretskii

Avoid race in rcirc process filter (bug#33145)

* lisp/net/rcirc.el (rcirc-filter): Clear rcirc-process-output
before processing its constituent lines.  Otherwise, if rcirc-filter
runs again before the last rcirc-process-server-response is
finished, the contents of rcirc-process-output could be duplicated.
parent 88ef31ab
......@@ -753,12 +753,12 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.")
(with-rcirc-process-buffer process
(setq rcirc-last-server-message-time (current-time))
(setq rcirc-process-output (concat rcirc-process-output output))
(when (= (aref rcirc-process-output
(1- (length rcirc-process-output))) ?\n)
(mapc (lambda (line)
(rcirc-process-server-response process line))
(split-string rcirc-process-output "[\n\r]" t))
(setq rcirc-process-output nil))))
(when (= ?\n (aref rcirc-process-output
(1- (length rcirc-process-output))))
(let ((lines (split-string rcirc-process-output "[\n\r]" t)))
(setq rcirc-process-output nil)
(dolist (line lines)
(rcirc-process-server-response process line))))))
(defun rcirc-reschedule-timeout (process)
(with-rcirc-process-buffer process
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment