Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3301270pxk; Mon, 21 Sep 2020 10:04:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzccKLf18oQplJu3U25FbxNHSRPcT+GhioU0Hq1Cq4YY0xwzir3BiGYZKmDrm3mn1XdHNsv X-Received: by 2002:a50:ec10:: with SMTP id g16mr655205edr.214.1600707870672; Mon, 21 Sep 2020 10:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600707870; cv=none; d=google.com; s=arc-20160816; b=S30+Fkrs2iW14sgJDoPCfGxeXaDmCm4fzc4sXpPUHTLgKizeTBuRoC1OJ+m+dEE2ok Ahk7mhQSZ2F2SHsa/IexFeA0g3RSjmLSAwSGT1og0j0fZIqDDskJfQY0/yzV7mEXD7iG ty6SipxsXz4dzlrw3u8Lh8C3RvxwTDKd0LdQYpXHpLfWSrEtR7gmsv3dA15IUSnVlhNu OkJZkvkQtU5A+x3eYW+67gFYLSff2lXyUCfgveEkWmhGP+KKwWaTowuztkBiivunc2Je qRhnF+D1KO++tdXtAKQjdyLX3BGvM1z+W1SwYZnczpttGEKiGn3zTusGnGpMjMETKzV9 EE+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+KXZrDApAPE5+qFx1urONjv9sx/5YJ8As+CRvg0qZAY=; b=w1tr321RRmxHyzkGsy5E5lJBgL6DPOicSO0KUgDRkF81KIroYBvVoLUfeIOfPWNIVk 9uG/T7G69uByPTCrOjOH/8NU3vZw0n9LFkejc/Wcc1NuGRQgHN7iflGMg3S6i/N5zwAA upJGNtkMQC7IzDkv4UXqOzIHxI/D7QDCutOXx6cIJ7I7I23Ri98oNV4SV4J7R6JGyuge bfa56ogq3B+qdBa/QXJLTn/28uWGrXIqAVhs6cYsymigUilMgXTncFyG5mWtGKi+cvrs /qwgDiUmnhk/UsMfb4/77E+XnVqIhH0uZ/4iYQuGcJbfypubkbd0rjQoDaJjFxKbDTB8 zS5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gaehuoWi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s6si8468749edi.427.2020.09.21.10.04.06; Mon, 21 Sep 2020 10:04:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gaehuoWi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730283AbgIURBG (ORCPT + 99 others); Mon, 21 Sep 2020 13:01:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:41184 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729248AbgIUQjV (ORCPT ); Mon, 21 Sep 2020 12:39:21 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8E12C238E6; Mon, 21 Sep 2020 16:39:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706360; bh=knS8FPNcyyqmkh3CpwOuhNqwqY941BtDC7iZCaQmojQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gaehuoWieu1bcbPzvpAqrlGKWdbAPDlC4NW6XqXqPo0hMWYXTZi0opJsIWGtbb7/N Ro64LpLnxIpj1CNzjz4zkCIEippf6zJ+2mSstLI8hllk0eVbhG0NiuM434tQiIbFyC LmZrFjjy7VzYKbbfbeMyYI/J1bPjXSTVVxhqjB9A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhi Li , "J. Bruce Fields" , Trond Myklebust , Sasha Levin Subject: [PATCH 4.14 69/94] SUNRPC: stop printk reading past end of string Date: Mon, 21 Sep 2020 18:27:56 +0200 Message-Id: <20200921162038.695509581@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162035.541285330@linuxfoundation.org> References: <20200921162035.541285330@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: J. Bruce Fields [ Upstream commit 8c6b6c793ed32b8f9770ebcdf1ba99af423c303b ] Since p points at raw xdr data, there's no guarantee that it's NULL terminated, so we should give a length. And probably escape any special characters too. Reported-by: Zhi Li Signed-off-by: J. Bruce Fields Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- net/sunrpc/rpcb_clnt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index da21efac80f4a..7c0b1feb36299 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c @@ -981,8 +981,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, p = xdr_inline_decode(xdr, len); if (unlikely(p == NULL)) goto out_fail; - dprintk("RPC: %5u RPCB_%s reply: %s\n", req->rq_task->tk_pid, - req->rq_task->tk_msg.rpc_proc->p_name, (char *)p); + dprintk("RPC: %5u RPCB_%s reply: %*pE\n", req->rq_task->tk_pid, + req->rq_task->tk_msg.rpc_proc->p_name, len, (char *)p); if (rpc_uaddr2sockaddr(req->rq_xprt->xprt_net, (char *)p, len, sap, sizeof(address)) == 0) -- 2.25.1