GNU bug report logs - #37344
rcirc: nil gets interpreted as a nickname

Previous Next

Package: emacs;

Reported by: Naïm Favier <n.emacs <at> monade.li>

Date: Sun, 8 Sep 2019 19:06:01 UTC

Severity: normal

Tags: patch

Fixed in version 26.4

Done: Leo Liu <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 37344 <at> debbugs.gnu.org (full text, mbox):

From: Naïm Favier <n.emacs <at> monade.li>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 37344 <at> debbugs.gnu.org
Subject: Re: bug#37344: rcirc: nil gets interpreted as a nickname
Date: Mon, 9 Sep 2019 11:56:55 +0200
Yes, it does.

On Mon, 9 Sep 2019 at 03:24, Leo Liu <sdl.web <at> gmail.com> wrote:
>
> On 2019-09-08 20:58 +0200, Naïm Favier wrote:
> > Severity: normal
> >
> > Ever since I changed my nickname to "nil" on Freenode, I've been
> > getting occasional private messages from unknown users consisting of a
> > single empty CTCP ACTION. After a bit of investigating, it turned out
> > they all used rcirc. The situation was clear at that point: somewhere
> > in rcirc's source code, a nil value is being implicitly converted to a
> > string and used as the target of a PRIVMSG command.
> >
> > The bug seems to be reproducible by issuing "/me" (without arguments)
> > inside a server buffer: the "nil" user on that server gets sent an
> > empty ACTION.
> >
> > Suggested fix: in rcirc-send-privmsg, fail if target is nil. It might
> > be useful to check other places where the "%s" format is used, to
> > discover similar bugs.
>
> Thanks. Does the following patch fix the issue?
>
> diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
> index de524d9e..d95db26c 100644
> --- a/lisp/net/rcirc.el
> +++ b/lisp/net/rcirc.el
> @@ -825,6 +825,7 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.")
>      (process-send-string process string)))
>
>  (defun rcirc-send-privmsg (process target string)
> +  (cl-check-type target string)
>    (rcirc-send-string process (format "PRIVMSG %s :%s" target string)))
>
>  (defun rcirc-send-ctcp (process target request &optional args)
> @@ -2337,8 +2338,8 @@ With a prefix arg, prompt for new topic."
>    (let ((timestamp (format-time-string "%s")))
>      (rcirc-send-ctcp process target "PING" timestamp)))
>
> -(defun rcirc-cmd-me (args &optional process target)
> -  (rcirc-send-ctcp process target "ACTION" args))
> +(defun rcirc-cmd-me (args process target)
> +  (when target (rcirc-send-ctcp process target "ACTION" args)))
>
>  (defun rcirc-add-or-remove (set &rest elements)
>    (dolist (elt elements)




This bug report was last modified 5 years and 223 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.