Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5995329ybc; Wed, 27 Nov 2019 13:05:55 -0800 (PST) X-Google-Smtp-Source: APXvYqwoygUz2rmspCkkpOq+0cv0MJNIVBrUqDs3r/gYNLYui4E8czFtwE4+LEZHiZlPUQskuZMT X-Received: by 2002:a17:906:194a:: with SMTP id b10mr51451290eje.123.1574888755223; Wed, 27 Nov 2019 13:05:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574888755; cv=none; d=google.com; s=arc-20160816; b=nijI8pXIREjEdSgEtQBv2zcAxmPfDlonwSh11RBsUsm80kWWUKfD7r7H+6gZ/Wvytr E5HdAZ0wqZpAXdD8ksor+v9m5P1h6SkZRY7McTMMwuvWCgfCf6gFEyj3TVdfbv36fgRr x8dbxF3EVvzDP+kNbP3vzDqSdQ9+zS9DtrlKuSNuo1fmrGV1Bmt2No3IQUNVKYjfqMLP 0k+xJJwFmx/xfXMGt1uugOd+REKoz22JWqhGIjqd9rNrzBILP9L+CQZZQzQv+4YwHLPE XtXGS63Qb5VkVdjrIsRqfnXssd5YZRjfllcr6YnvSuEhx1+c4KFXPNHRgFLwZ0yfZSKa cCIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aqC941Q5CrxGq76qQRG7gllRzlNesGjLzL2u+mgY3HE=; b=wouvWKa5Kcy9+ek0ylN7ZLXqVkk+vdTdjtxER17pmuQlEHbzeyf0rhdNqGFxmEO+Y5 6Q4dEqP9o0Z09mtPwbaqMh+aACvXHj9T1loKbdKncHbjrFFSvJ08jIrZJi20RXrNPHGf lkmmj85ibAr4Q4u8fiI1R4HfKOWkXJxZoI3sQYy09hDx1H5UtLEbShEjAUABWYkuXsrt HvX+bx6Nwyz3uGBKAFYC89qC1gCkR7UxaEBtWE/vj+35omi/PPVLbHI+IdoIY7Q/cfhz orILXvqWW+KcZyIQ+DezhEtFMFCydHU4ebNrLsi+xrKjknB6p+xqIjefua73SP0gwtf5 /JrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oBFSsJyN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si9880313eji.232.2019.11.27.13.05.31; Wed, 27 Nov 2019 13:05:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oBFSsJyN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732156AbfK0VE3 (ORCPT + 99 others); Wed, 27 Nov 2019 16:04:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:57942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727451AbfK0VEZ (ORCPT ); Wed, 27 Nov 2019 16:04:25 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 03FB42166E; Wed, 27 Nov 2019 21:04:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888665; bh=f3p0+OOe1ibP/2Z3UThvNrX9bE05ArFaE5ezJvS5zgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oBFSsJyNWWPDbp6E+isdMNT3rZE50X82Sj++nG0aUbAn0Qky0qDjip5JAazO6ljDC b8SrTkJZCRSg9P+y/Dg1ICi5TDOqvhF+VItVe9vL7niAsxzEArbjK9902r+L59VOf/ JSlEhYAjA5hHXoGrGV9xyJ6IEO4rAKy3DbkIW8nc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 221/306] wireless: airo: potential buffer overflow in sprintf() Date: Wed, 27 Nov 2019 21:31:11 +0100 Message-Id: <20191127203131.194506962@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 3d39e1bb1c88f32820c5f9271f2c8c2fb9a52bac ] It looks like we wanted to print a maximum of BSSList_rid.ssidLen bytes of the ssid, but we accidentally use "%*s" (width) instead of "%.*s" (precision) so if the ssid doesn't have a NUL terminator this could lead to an overflow. Static analysis. Not tested. Fixes: e174961ca1a0 ("net: convert print_mac to %pM") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/cisco/airo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c index 04dd7a9365938..5512c7f73fce8 100644 --- a/drivers/net/wireless/cisco/airo.c +++ b/drivers/net/wireless/cisco/airo.c @@ -5462,7 +5462,7 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) { we have to add a spin lock... */ rc = readBSSListRid(ai, doLoseSync, &BSSList_rid); while(rc == 0 && BSSList_rid.index != cpu_to_le16(0xffff)) { - ptr += sprintf(ptr, "%pM %*s rssi = %d", + ptr += sprintf(ptr, "%pM %.*s rssi = %d", BSSList_rid.bssid, (int)BSSList_rid.ssidLen, BSSList_rid.ssid, -- 2.20.1