Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1139247pxb; Fri, 27 Aug 2021 02:03:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydxtNLGU8qEDxXgHaMUV7iQ2nB7kqpnxs/4fFpYyxgfQdV9hMibANGM1ls0ivbL8A+MJis X-Received: by 2002:a17:906:c1d0:: with SMTP id bw16mr8992173ejb.146.1630054996191; Fri, 27 Aug 2021 02:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630054996; cv=none; d=google.com; s=arc-20160816; b=f6DjPzB64YzRsAcj4I24gH5e+Xv8FcjbLhy5r/i73EKCHVumK4LxsUa7mxK2gJ4Fa8 NY8Fq1oxgTIJszdAZ/L2TclbW2UjKzz+FjFPpqXl0XLgs8tn6KsLJKy8+iDBDg2623BN BK/h5EToar7QK8jiqNJBGq2RKk1P8s9zoTuRPZfC9IaGMNXCeiwi7ielr2sux3R5FlBk w0Ak/wP6gOcjZ56ZNEVg3YLKo2K0BaW8wT/iWLlzCs01yB/fedHqdVtSep908bXDthVy WH37/tPE10Mddedy0VameJBk+91RUbYb3CitjUKI4duhV3H7i4gI+xxMcDu9YGRs0hz6 BWHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=dR85NjlBnsEfD4ItpoEv8i4dv3AbkGejzFu1tFYkWZM=; b=sTrW6LTj2Mqgx17tkvPvwzwyUGEvdd27p1GSWQ1DjPH0gjgdfmc7v94nw8ewp3nSPt p4pUZYGcNZNcPeYakVPlq1vZhFJBGCwIVMORzwaHAIkXqjVOKLs8rPl36i6fRFqX0jCo aMut3DoqubEV0/N/s8W6097iKRi2A6ajcqYech0YFIynU1C+pZcNKavzoTyTohmFNkNw GoaMPYbEwjCzijYJ5ilE40KJWHbd/ylAfhtAXl9psImSpayjFzP6yfrsNUqEQwlvbNWN wLRUTccByWqvoR4qZIq7j1OsNhrTFcmZjvEOE3nvBR3fDxLvfayqhw+bZGUcWznIJD0k wG4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=J0RJbkPg; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ji1si3737312ejc.49.2021.08.27.02.02.53; Fri, 27 Aug 2021 02:03:16 -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=@gmail.com header.s=20161025 header.b=J0RJbkPg; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244624AbhH0JCG (ORCPT + 99 others); Fri, 27 Aug 2021 05:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244622AbhH0JCF (ORCPT ); Fri, 27 Aug 2021 05:02:05 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5769DC061757 for ; Fri, 27 Aug 2021 02:01:17 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id c4so3520097plh.7 for ; Fri, 27 Aug 2021 02:01:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dR85NjlBnsEfD4ItpoEv8i4dv3AbkGejzFu1tFYkWZM=; b=J0RJbkPgWN2y0sUFHQIu0EyRwxEwsZMdtTxXejGs9Q0/ynW6rMw5jRcBbaaSOFSUhX WWSRZ1+vxknq7KgJSGJIphrr2T/jT3GrypuosJfJ6PLVH6bs+C9GHMyEHV+Gw0R9hvS2 zjNJNYcvyMf0Zy6tD8bNGsqIF88ErOSFNBGYFc77ZdTAk5umG+lh/l2m6NoJbtch4wlz vuFGRdMXaC78lwb6Z4vJl0cfpzCswnChbcdtFiQ/5kejB2HXTcwoZgrJhz1u1Hv+bZld elXGRp/LmxbhLFNQDnsATzQlzMrHHh3k2mOLsz1gfmYSIqr0Gc/+gu6gvimx65c/gYKh mYYw== 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:date:message-id:in-reply-to :references; bh=dR85NjlBnsEfD4ItpoEv8i4dv3AbkGejzFu1tFYkWZM=; b=qJ9T4xNBVR0l00SHMl3omieoHN3acUyA/VkuvFjVd6h7LSF/pRcNZIhN7lRRBvq5xm /in2o9Q+6Q2ze2saEWtljUfJO5s9lqyGubT8AY9dmMujYPXtXqpxyhHvwLf0IUIE6t5w 8XqdjS+XfrKGDUAudYSHdJkRvoJwDFegOKE7PimIZtHWrXih1jtRESnYTtkSWICfGuKk 5r88FAahoLTPlB3Vp++9YUSjeDARp9cDHz69Tp+i4J+pXK3AUhNHEZqb1p5OTC6LCspG M++7rgs7UwI+EK/UUvR58ijeTJCtb6wjmy7P+tzhlafzFsXosenkZxnZdkYn0GkjjJsC zZTg== X-Gm-Message-State: AOAM532gjPzTocAYO0Vv9V7h32SRg9zY/JqxUvaDnSkleR2rlrm4yVig V1F21bxHK1ZzKK+VNsn+JFA= X-Received: by 2002:a17:902:6acb:b0:132:1ce7:c829 with SMTP id i11-20020a1709026acb00b001321ce7c829mr7601592plt.68.1630054876860; Fri, 27 Aug 2021 02:01:16 -0700 (PDT) Received: from localhost.localdomain ([112.17.247.23]) by smtp.gmail.com with ESMTPSA id v7sm5478604pjk.37.2021.08.27.02.01.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Aug 2021 02:01:16 -0700 (PDT) From: Wenlong Zhang To: gregkh@linuxfoundation.org Cc: fabioaiuto83@gmail.com, ross.schm.dev@gmail.com, marcocesati@gmail.com, insafonov@gmail.com, cyruscyliu@gmail.com, yajin@vm-kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Wenlong Zhang Subject: [PATCH v2] staging: rtl8723bs: prevent ->ssid overflow in rtw_wx_set_scan() Date: Fri, 27 Aug 2021 17:00:27 +0800 Message-Id: <20210827090027.23158-1-yixiaonn@gmail.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 74b6b20df8cf ("staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan()") fixed up the staging driver rtl8188eu by adding another check to prevent writing beyond the end of the ->ssid[] array. Resolve this by properly fixing up the rtl8723bs driver's version of rtw_wx_set_scan() Fixes: 74b6b20df8cf ("staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan()") Signed-off-by: Wenlong Zhang --- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 902ac8169948..6fc1020cea11 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -1351,9 +1351,9 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, sec_len = *(pos++); len -= 1; - if (sec_len > 0 && sec_len <= len) { + if (sec_len > 0 && sec_len <= len && sec_len <= 32) { ssid[ssid_index].SsidLength = sec_len; - memcpy(ssid[ssid_index].Ssid, pos, ssid[ssid_index].SsidLength); + memcpy(ssid[ssid_index].Ssid, pos, sec_len); /* DBG_871X("%s COMBO_SCAN with specific ssid:%s, %d\n", __func__ */ /* , ssid[ssid_index].Ssid, ssid[ssid_index].SsidLength); */ ssid_index++; -- 2.15.0