From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Leo Liu Newsgroups: gmane.emacs.bugs Subject: bug#37344: rcirc: nil gets interpreted as a nickname Date: Mon, 09 Sep 2019 09:24:26 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="104189"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (macOS 10.14.6) Cc: 37344@debbugs.gnu.org To: =?UTF-8?Q?Na=C3=AFm?= Favier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 09 03:25:20 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 1i78Qi-000QtN-1o for geb-bug-gnu-emacs@m.gmane.org; Mon, 09 Sep 2019 03:25:20 +0200 Original-Received: from localhost ([::1]:51564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i78Qb-0000a4-22 for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Sep 2019 21:25:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54226) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i78QS-0000Y5-2L for bug-gnu-emacs@gnu.org; Sun, 08 Sep 2019 21:25:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i78QQ-0004mM-T7 for bug-gnu-emacs@gnu.org; Sun, 08 Sep 2019 21:25:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58773) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i78QQ-0004mG-Pb for bug-gnu-emacs@gnu.org; Sun, 08 Sep 2019 21:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i78QQ-00062Z-I9 for bug-gnu-emacs@gnu.org; Sun, 08 Sep 2019 21:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Leo Liu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Sep 2019 01:25:02 +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.156799228023189 (code B ref 37344); Mon, 09 Sep 2019 01:25:02 +0000 Original-Received: (at 37344) by debbugs.gnu.org; 9 Sep 2019 01:24:40 +0000 Original-Received: from localhost ([127.0.0.1]:39361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i78Q4-00061v-6j for submit@debbugs.gnu.org; Sun, 08 Sep 2019 21:24:40 -0400 Original-Received: from mail-pg1-f196.google.com ([209.85.215.196]:41938) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i78Q1-00061d-LN for 37344@debbugs.gnu.org; Sun, 08 Sep 2019 21:24:38 -0400 Original-Received: by mail-pg1-f196.google.com with SMTP id x15so6814811pgg.8 for <37344@debbugs.gnu.org>; Sun, 08 Sep 2019 18:24:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=PieM5zr0OTnkbzEhL8Uj0m5uy767ub5D2Hf4npRQf8c=; b=RlIJBgQfBbmFODOY63iob7Pau2ja2yANR3PvJOlqaBIsPwj4D/hEJNRZ+93Y8b3MuP OXKuuW9tynC8F7HbvYEbz0zTzfCmh0XEEnaJ0umCRLEgMLFPC4PCbJ1jkNQH2Kt+EG+R 78A2cdgXOANDJ+bSjorISVXCZn2OZtbyikTkcN6e+iYDdRNnMmagnLxw2C9jBKk14e7t WR06P90Ik5Iuxx8GxV2H6wOWQyVWn+7O4vZl1C+9U79AsNE/b1pMGF5Z2Ly6j6iWzFAY 2oCY3Z117/yEcOzCBNTHJMkSULFf185t9qi8tknHOukbljPMfkPeT/vSI2ZzPAuROyrZ B/tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:face:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=PieM5zr0OTnkbzEhL8Uj0m5uy767ub5D2Hf4npRQf8c=; b=sR/8gp42OV++IXX228pY3SHv/uvSZhMoWECJc22CcWJ3B3kevkmbjgklypk9ebEFpW 8F+3trBM+QvEd41PHeHkeJjhHTr1U3f5cl41l/OmD+f8m5UTADi/+nQffWPaw/dt3zgx 6IFIzRo5nHTL6KOVhu+GvJKfI1HvgSSNv7YyXmCkxM92MfWHCp9UyjfxEtzl7k/pT+0j lIcikR0DNxYTnsdC7+UrSSLgKJ8DElyEebNHZIdN61LsJiktbYcfrpWWMY+jPvA1Qpy9 CsbQsNTh/kAUE1Plh/uEn1W03jP5XIj8EQfdtCcbOhUnW57hYapF1XTBFO8i2hiWtysL RycA== X-Gm-Message-State: APjAAAXq+e0YkSn2vhDjy00a2EhwgQzqCF1upZrLMFloISKkBBuK9UUL qaxobGKHdQ7vOE1CmYFQXCd9dTNq X-Google-Smtp-Source: APXvYqzbsbbBt6u/pf3xGM+n2MYWp7jlZhVIMSLUzW2DSSonfBfKj+U9PLBCX5irYUxQgB1Vu1gYLA== X-Received: by 2002:a17:90a:2e08:: with SMTP id q8mr23195566pjd.43.1567992271389; Sun, 08 Sep 2019 18:24:31 -0700 (PDT) Original-Received: from Zeuss-MacBook-Air.local ([112.208.225.37]) by smtp.gmail.com with ESMTPSA id v8sm10037055pgs.82.2019.09.08.18.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 18:24:30 -0700 (PDT) Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAElBMVEUAAAAAAP+LRRP0pGC+ vr7///+7mT1iAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9cBBwMO DhglKe4AAAEsSURBVCjPbZNBboQwDEV/Cd4X9QJRThApmn0XYW+Jyf2v0m+HhqDBgiAe9rcTG7QH w/1Vn2Ar8gBb/ocywSN3qK9T3z4eFDB4eApocBpeBs1RSykoJd8gQcm8pGmHXFso3ajnmsqV0TnY DQkOfXUfN5NwaI7AWTVOyEhcu1aHmdWItHddUVUcUgUBCkitu8V6ditHVOVdqzl2EQ1ZVGTbdK0V 7cqn8vWzoU5Q/bF9Y/Y0cRU1xwkys5dJ+Dt6pBDWifcNQml8Gh2JVmPSoQzo7en0grswkxrUGYJ7 0hSxxAGr7ZMwYcHIzprpi7TENEE1xtiYxixRlCfPBsUUrwHD7uGIwATrbnODJcVrPpVn3hxiGloe m/S+z3CtuzUSMo83N4DPH+F0evwR3P4A2k+75838OKQAAAAASUVORK5CYII= In-Reply-To: ("=?UTF-8?Q?Na=C3=AFm?= Favier"'s message of "Sun, 8 Sep 2019 20:58:59 +0200") 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:166318 Archived-At: On 2019-09-08 20:58 +0200, Na=EFm 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))) =20 (defun rcirc-send-privmsg (process target string) + (cl-check-type target string) (rcirc-send-string process (format "PRIVMSG %s :%s" target string))) =20 (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))) =20 -(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))) =20 (defun rcirc-add-or-remove (set &rest elements) (dolist (elt elements)