From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Na=C3=AFm?= Favier Newsgroups: gmane.emacs.bugs Subject: bug#37344: rcirc: nil gets interpreted as a nickname Date: Mon, 9 Sep 2019 11:56:55 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="196561"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 37344@debbugs.gnu.org To: Leo Liu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 09 16:38:18 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i7Ko4-000oyP-9L for geb-bug-gnu-emacs@m.gmane.org; Mon, 09 Sep 2019 16:38:16 +0200 Original-Received: from localhost ([::1]:57472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7Ko2-0003vS-Is for geb-bug-gnu-emacs@m.gmane.org; Mon, 09 Sep 2019 10:38:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42573) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7Kns-0003sq-K7 for bug-gnu-emacs@gnu.org; Mon, 09 Sep 2019 10:38:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7Knr-0003cE-ID for bug-gnu-emacs@gnu.org; Mon, 09 Sep 2019 10:38:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59816) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7Knr-0003c7-FV for bug-gnu-emacs@gnu.org; Mon, 09 Sep 2019 10:38:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i7Knr-00080s-Am for bug-gnu-emacs@gnu.org; Mon, 09 Sep 2019 10:38:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Na=C3=AFm?= Favier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Sep 2019 14:38:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37344 X-GNU-PR-Package: emacs Original-Received: via spool by 37344-submit@debbugs.gnu.org id=B37344.156803985030737 (code B ref 37344); Mon, 09 Sep 2019 14:38:03 +0000 Original-Received: (at 37344) by debbugs.gnu.org; 9 Sep 2019 14:37:30 +0000 Original-Received: from localhost ([127.0.0.1]:40401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i7KnJ-0007zh-Qi for submit@debbugs.gnu.org; Mon, 09 Sep 2019 10:37:30 -0400 Original-Received: from mail-io1-f65.google.com ([209.85.166.65]:38460) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i7GQ4-00071Q-QC for 37344@debbugs.gnu.org; Mon, 09 Sep 2019 05:57:13 -0400 Original-Received: by mail-io1-f65.google.com with SMTP id k5so1926719iol.5 for <37344@debbugs.gnu.org>; Mon, 09 Sep 2019 02:57:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=wuOcRSbvMUm20OwizjX0v02QFDAC0LDKpeqc6YBCOyU=; b=TtF9B/tD0k65JkLNIDBUrlkF88kbCP78dlgeiWJqpEgf0Ur4Icnyrbra7KFJU5A5TO +K0qlKkx5f26yEoINLgvqr27A/UlboeNxaeUcIR1izAVWdvHxfGCKnfgpqqfxaQdREwd 9LwvRSITxw2vHKDEEf5shEyb44aFBSNnLKPAXG/31eYVmZVZ0qW9D0eeoDqxWqP1VfmO Cerax9zJPaA+Nd3gl/RMagNe7CA0j0Ssyk8emr444NHVOJikL/xJA0Ebdz9fRA5Rid9s mjSqOSM4sTyIaSCVMUbCLMuLj1tcmwqdvW3Wk0nNywFI0HclohE0RkZtswqhwAvzO9Oc O29Q== X-Gm-Message-State: APjAAAXu0pzlEcr9RBE1S4dm4MKQftbBBbFSRQb1c5V2zei1BRDHDfpM 0XJgRQ5J491osDGmO0v8infMDKWvRCw= X-Google-Smtp-Source: APXvYqwVkyPo89JF5FrU08P+WBCpyern2nGvDREJTl707wPK6FRGZxohnHZ03pBkodnZ9N5zr/BCxg== X-Received: by 2002:a6b:5b07:: with SMTP id v7mr3755980ioh.76.1568023026894; Mon, 09 Sep 2019 02:57:06 -0700 (PDT) Original-Received: from mail-io1-f43.google.com (mail-io1-f43.google.com. [209.85.166.43]) by smtp.gmail.com with ESMTPSA id i14sm11596018ioi.47.2019.09.09.02.57.06 for <37344@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Sep 2019 02:57:06 -0700 (PDT) Original-Received: by mail-io1-f43.google.com with SMTP id r8so2303522iol.10 for <37344@debbugs.gnu.org>; Mon, 09 Sep 2019 02:57:06 -0700 (PDT) X-Received: by 2002:a5e:aa1a:: with SMTP id s26mr4456014ioe.96.1568023026361; Mon, 09 Sep 2019 02:57:06 -0700 (PDT) In-Reply-To: X-Gmail-Original-Message-ID: X-Mailman-Approved-At: Mon, 09 Sep 2019 10:37:29 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:166329 Archived-At: Yes, it does. On Mon, 9 Sep 2019 at 03:24, Leo Liu wrote: > > On 2019-09-08 20:58 +0200, Na=C3=AFm 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, ARG= S 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)