Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3528499pxf; Mon, 15 Mar 2021 11:34:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw29QXWxWQ91oiMIBtjDPhavHrF6Ljt/ID24bPDxhoI2m504XtB85U2yk+TEdUoo0SbYTt6 X-Received: by 2002:a17:906:8a6e:: with SMTP id hy14mr25672433ejc.356.1615833244739; Mon, 15 Mar 2021 11:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833244; cv=none; d=google.com; s=arc-20160816; b=KAiHN7VsyXBz++cwfy2niB/6PhCLwHBMlDzQo0FaFUi2IYQTagQ3Pa1TRnJ24fUkrd 2JKh2h76epHpiu/OpViO7K4vF0rr8bEehnBvlxjkj6Ls7/OvMDjVYvvKw/6+LlkzcLVA BEW6d+1fjtY7CycKyojZ8Gls29LHwpRlkQHLzm3Qbz6rEcVCExag4L1fLqN6IYvN1NCw Dj4P7oGB4LmZmVGy9moY3CBBn4Sh4ZLe9slSpeBEw+OJTqcUI+NAFbZI0+rV4CSHxmRC v/ZBRSurbqp3tE59EGRZs+zPRcv2pLzlB9MZYZe4szzsb3XAfrqNowVr7vC9IBCGCMH/ vhmQ== 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=WWezpfCr0p7ZmnirJQIt8pjaKma+j4g/8Nb0eYA55YU=; b=eBAQ+xyz4oSihMEJfWan+nK6Gtoh7dbD8AEnUbpHwk5ad1kPBjpDSn7AR6GERtpOE3 lfRMl8nm7vvmPPzTsh0LHXDHhlXhlUBR8VEjTpo/6Kb2AxmRj5sjzSoK1plkGm2QFp6P iT1u1FwrtjoNuMS/9fW6gewVyr5eftwJO3OoXmnbu4eOc5ermTBWfaR8VM2EtGPp5hFe /ak/nIMeMSQhErPxm7GXK4+dVTVYVlpC8nCkyRXs8oi2AE9UtWpHD6N24lEJKoHXaC60 t+Xh4UnZ+a1wMyhkPK6SaiO8fD7p6liawUMsiZtcwoSPvni5ZOsWdRY4HcsXEIZFtlv0 8nGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="UJi6Pqi/"; 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=pass (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 a11si11257831edr.205.2021.03.15.11.33.42; Mon, 15 Mar 2021 11:34:04 -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=@linuxfoundation.org header.s=korg header.b="UJi6Pqi/"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238071AbhCOOmP (ORCPT + 99 others); Mon, 15 Mar 2021 10:42:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:49440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234148AbhCOODA (ORCPT ); Mon, 15 Mar 2021 10:03:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DD80A64E89; Mon, 15 Mar 2021 14:02:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816979; bh=0NRsVrDE7EWtRcFT0zTAxJTNzb7xxXoAYVoQRkYqv7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJi6Pqi/wPG7AusSp230udpFkyMIkOvjxXAT093pYeQamI7botkzhQyAXh569rfpX Ic4eB31ciTaGy/wmJyNwKsv0kNlXWIAAgF7QPFWWJWh4G5VULLrJkqePy4AzE7lFdf /A/CkyHcYhhhQvATeXmJ/dU4do9catG2H3bEbj5U= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter Subject: [PATCH 5.10 225/290] staging: rtl8192u: fix ->ssid overflow in r8192_wx_set_scan() Date: Mon, 15 Mar 2021 14:55:18 +0100 Message-Id: <20210315135549.587932038@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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: Greg Kroah-Hartman From: Dan Carpenter commit 87107518d7a93fec6cdb2559588862afeee800fb upstream. We need to cap len at IW_ESSID_MAX_SIZE (32) to avoid memory corruption. This can be controlled by the user via the ioctl. Fixes: 5f53d8ca3d5d ("Staging: add rtl8192SU wireless usb driver") Signed-off-by: Dan Carpenter Cc: stable Link: https://lore.kernel.org/r/YEHoAWMOSZBUw91F@mwanda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_wx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -331,8 +331,10 @@ static int r8192_wx_set_scan(struct net_ struct iw_scan_req *req = (struct iw_scan_req *)b; if (req->essid_len) { - ieee->current_network.ssid_len = req->essid_len; - memcpy(ieee->current_network.ssid, req->essid, req->essid_len); + int len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE); + + ieee->current_network.ssid_len = len; + memcpy(ieee->current_network.ssid, req->essid, len); } }