From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B8E5C433E0 for ; Fri, 26 Feb 2021 12:06:55 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 29E3B64ED2 for ; Fri, 26 Feb 2021 12:06:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 29E3B64ED2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C6B176F8C2; Fri, 26 Feb 2021 12:06:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HAfJwkQHHxTs; Fri, 26 Feb 2021 12:06:54 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id C40266F912; Fri, 26 Feb 2021 12:06:53 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 3D1FF1BF8C7 for ; Fri, 26 Feb 2021 12:06:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 39FFD84055 for ; Fri, 26 Feb 2021 12:06:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=linuxfoundation.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7ojThiNeobVj for ; Fri, 26 Feb 2021 12:06:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp1.osuosl.org (Postfix) with ESMTPS id 2D4AA8402E for ; Fri, 26 Feb 2021 12:06:51 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 31B4864E85; Fri, 26 Feb 2021 12:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614341209; bh=qRTRg+Ld1JvWeMc0olIaD6Tm+zb/5qtWSSfoEhnQEC0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OvGNyIN4O2RQfLtsNLJNBpTtgzJmKKoCEooXcKepz4kiyHOoLUziEn22HCgGiN0nP i3pTPTXpw2lVDZcOIebficIYrr1MUCf9QBzfiAcNj2IK7Qj5KSXs4nLCvngCPbsox4 RdpxlHQh7K/n0uAjto/Or+M7Y5PUw5pcgBeqZA/s= Date: Fri, 26 Feb 2021 13:06:46 +0100 From: Greg KH To: Lee Gibson Subject: Re: [PATCH] staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan Message-ID: References: <20210226114829.316980-1-leegib@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210226114829.316980-1-leegib@gmail.com> X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" On Fri, Feb 26, 2021 at 11:48:29AM +0000, Lee Gibson wrote: > Function _rtl92e_wx_set_scan calls memcpy without checking the length. > A user could control that length and trigger a buffer overflow. > Fix by checking the length is within the maximum allowed size. > > Signed-off-by: Lee Gibson > --- > drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c > index 16bcee13f64b..2acc4f314732 100644 > --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c > +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c > @@ -406,6 +406,9 @@ static int _rtl92e_wx_set_scan(struct net_device *dev, > struct iw_scan_req *req = (struct iw_scan_req *)b; > > if (req->essid_len) { > + if (req->essid_len > IW_ESSID_MAX_SIZE) > + req->essid_len = IW_ESSID_MAX_SIZE; > + How about using the "pattern" the other wireless drivers use of: int len = min((int)req->essid_len, IW_ESSID_MAX_SIZE); instead? thanks, greg k-h _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel