Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1321700yba; Tue, 2 Apr 2019 06:50:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyifImPbSCVImH+mfOmx/8WiuQ0P8WiePR3KlOskAqyyJwxoAWkPfdx8LGh0aob4PvOLChU X-Received: by 2002:a63:fd07:: with SMTP id d7mr66265747pgh.199.1554213055818; Tue, 02 Apr 2019 06:50:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554213055; cv=none; d=google.com; s=arc-20160816; b=b8Ks8z93KvmW/u7HjTWBuM546eecd8Pb2mfGzy+kkayjMdfUQXq2cqMzGyghxQgeB6 e0t05IM2jZxG5MVGC1V3dfhjNHmzTsWv2uJ/AJL1Kh18h9pJC8XRlZAacD2wYhaISuhy uSs7fT/am1JaoEo575Mq7q1zLOnYbeVZUkBmgInqO12dedftaymOPn4F9aNUE6dHXzKl UQYhTm0KlY+OXOYPFnGLONd7r5zm6uewbGoJiM6SazxsZE4aiXr39q65K/gQLhiW9cxa fCBBYFpN+QYjAMAMTX5e2H/LTnOWCYrohzz6tSfudt+hmEaImgwTHZ+c01F0s9myZlIi 6CYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=n3zH0Wd432S2dVXep5YLQCU2iTd8cGNdZkFC+ePrLck=; b=lKtJJDu7iwVVvLyvx3Aof4+ddNVrbfFDMEYEAsT8XYh1No9J1xnidvjylBVrGog3Je xkLNdX4yAAlcuARvVHHnZ8nEuTj5SHcDXcZxwOj6NuMSkQe6qTGnm+DHKKSkdP5K5BSH ShJROIbz4Z171j1Ns4Ys39ipiVcr8OxN2NJfF65SEWlnumcBMeVJustRRQ3ppqq9QGqF LNa+2VPMuVM/SWr8bdOKvr2ArRriqWWe7y24jqkdKyuTQIRm3gTiD/v6etBICA/fIg42 3oXTgslvizvySCKfKngUPLGd0NkJil+qR9TIFMUdpRxEppuDLY9Z+AAQQybF6BKE2dBD 1oCA== ARC-Authentication-Results: i=1; mx.google.com; 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 j7si7434164pfb.75.2019.04.02.06.50.40; Tue, 02 Apr 2019 06:50:55 -0700 (PDT) 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; 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 S1731303AbfDBNkD (ORCPT + 99 others); Tue, 2 Apr 2019 09:40:03 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:42806 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731137AbfDBNkB (ORCPT ); Tue, 2 Apr 2019 09:40:01 -0400 Received: from [167.98.27.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hBJdu-0002mU-01; Tue, 02 Apr 2019 14:39:58 +0100 Received: from ben by deadeye with local (Exim 4.92) (envelope-from ) id 1hBJdt-0004qP-50; Tue, 02 Apr 2019 14:39:57 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Kalle Valo" , "Dan Carpenter" Date: Tue, 02 Apr 2019 14:38:27 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 01/99] wireless: airo: potential buffer overflow in sprintf() In-Reply-To: X-SA-Exim-Connect-IP: 167.98.27.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.65-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter commit 3d39e1bb1c88f32820c5f9271f2c8c2fb9a52bac upstream. 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 [bwh: Backported to 3.16: adjust filename] Signed-off-by: Ben Hutchings --- drivers/net/wireless/airo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -5469,7 +5469,7 @@ static int proc_BSSList_open( struct ino 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,