Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp997856rwj; Thu, 22 Dec 2022 18:58:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXs2m3i4ofGX6O2c3n3fmSrbtIS+283nFBA5YVpBvOCdAQPyNIdUrdeW1RNxh3HXXyCCgOct X-Received: by 2002:a62:f248:0:b0:576:1cb3:7981 with SMTP id y8-20020a62f248000000b005761cb37981mr8408791pfl.32.1671764290026; Thu, 22 Dec 2022 18:58:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671764290; cv=none; d=google.com; s=arc-20160816; b=LIrHL053v2/zvFAR2hV6pALfeuQPcujq+u3uHpA088FPhEQIyrqWdv17aJrqfgZ2Td pMN8RR4wONCVa8erSqltSUCYpTFlrNhc7Fmml73qH4UwLs8gnpY4N7u+uzniaIfev9OI Y21UA83zWmuf1dJPkm2q6Ux+t1Wq5UVRqe10Kyt7NqnCWJPw9sL2CEFf01ikhbpP0VBa Ja+YCCY1L5kqQKRC9Up5AEZmKUjeuOZW6frC1tQQ1w/vldbgeXaOQNHloMCum1ApvpR6 ErLeP8gzjhVN5ukicb6Glw5PWIzCXE6EqgrHGJ90k2l7czwzxFwFx1Kka/vfO6i6EgL3 Uw+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=N6fhsteUjt3CcDj40zQAQgTJDVZ3PVDXEq5HDDzTwFo=; b=KG+NdMge9I5dOLLJqgCTADRTlHFMUn9d1qTkBSemBQcXghNg5+4tYCJ5xUwNFmrph5 Qo4LwpeFGvD+4FZc8lkS4ue4xk1ULyicriep6zAaUKYaxcgQZSGARWl+0kxzGXprQ7bs KEaQzpABJxUsdydVcqijMI4JCkpre5Tr0mXbVvvCaA5Yt06j5y4zz4jaIbWJ41L2LIYs 7RIBG2+8eaim2wVSinK5+2vkkIh7hk/iVMcQD0rGu2+Sc0nb0J4XtXd0xlr6xwvPCiiI CPFGsfXU0kJfpHY2jc1sKHtcErbJynQLiRiYaMDhIvkxwBBbDT7WRmDW7F2yg8lbTOF3 P6hA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a056a0008c500b0050d80e4935fsi2641937pfu.256.2022.12.22.18.58.02; Thu, 22 Dec 2022 18:58:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235961AbiLWC5B (ORCPT + 66 others); Thu, 22 Dec 2022 21:57:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbiLWC4i (ORCPT ); Thu, 22 Dec 2022 21:56:38 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E68C31DD9; Thu, 22 Dec 2022 18:56:26 -0800 (PST) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4NdWzF4djFz6FK2Q; Fri, 23 Dec 2022 10:56:25 +0800 (CST) Received: from szxlzmapp03.zte.com.cn ([10.5.231.207]) by mse-fl2.zte.com.cn with SMTP id 2BN2uFBW063500; Fri, 23 Dec 2022 10:56:15 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp02[null]) by mapi (Zmail) with MAPI id mid14; Fri, 23 Dec 2022 10:56:16 +0800 (CST) Date: Fri, 23 Dec 2022 10:56:16 +0800 (CST) X-Zmail-TransId: 2b0463a518d0ffffffffbbbb3c8e X-Mailer: Zmail v1.0 Message-ID: <202212231056165052797@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , , , Subject: =?UTF-8?B?W1BBVENIIG5ldC1uZXh0XSB3aWZpOiBpcHcyMjAwOiB1c2Ugc3Ryc2NweSgpIHRvIGluc3RlYWQgb2Ygc3RybmNweSgp?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 2BN2uFBW063500 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 63A518D9.000 by FangMail milter! X-FangMail-Envelope: 1671764185/4NdWzF4djFz6FK2Q/63A518D9.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63A518D9.000/4NdWzF4djFz6FK2Q X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Xu Panda The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL-terminated strings. Signed-off-by: Xu Panda Signed-off-by: Yang Yang --- drivers/net/wireless/intel/ipw2x00/ipw2200.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c index ca802af8cddc..6656cea496b1 100644 --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c @@ -1483,8 +1483,7 @@ static ssize_t scan_age_store(struct device *d, struct device_attribute *attr, IPW_DEBUG_INFO("enter\n"); - strncpy(buffer, buf, len); - buffer[len] = 0; + strncpy(buffer, buf, len + 1); if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') { p++; -- 2.15.2