From patchwork Tue Oct 29 08:52:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Messerklinger X-Patchwork-Id: 2003632 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xd3wZ1F5lz1xwc for ; Tue, 29 Oct 2024 19:54:38 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1BA5388EF5; Tue, 29 Oct 2024 09:54:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=reject dis=none) header.from=br-automation.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 555E98915D; Tue, 29 Oct 2024 09:54:34 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from inet10.abb.com (inet10.abb.com [138.225.1.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6ED5689152 for ; Tue, 29 Oct 2024 09:54:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=reject dis=none) header.from=br-automation.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bernhard.messerklinger@br-automation.com Received: from brsmtp01.br-automation.co.at ([10.15.2.36]) by inet10.abb.com (8.15.2/8.14.7) with ESMTPS id 49T8sTGf2635863 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 29 Oct 2024 09:54:29 +0100 Received: from extmail.br-automation.com ([192.168.112.26]) by brsmtp01.br-automation.co.at (HCL Domino Release 14.0FP2 HF7) with ESMTP id 2024102909542897-433525 ; Tue, 29 Oct 2024 09:54:28 +0100 Received: from ATEGGE3725.br-automation.co.at ([10.43.64.28]) by extmail.br-automation.com (HCL Domino Build V1202_05192022) with ESMTP id 2024102909542931-13077 ; Tue, 29 Oct 2024 09:54:29 +0100 From: "Bernhard Messerklinger" To: u-boot@lists.denx.de Cc: "Bernhard Messerklinger" , "Tom Rini" , "Wolfgang Wallner" Subject: [PATCH 1/4] board/BuR/common: use strlcpy instead of strncpy Date: Tue, 29 Oct 2024 09:52:09 +0100 Message-ID: <20241029085258.1740289-2-bernhard.messerklinger@br-automation.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241029085258.1740289-1-bernhard.messerklinger@br-automation.com> References: <20241029085258.1740289-1-bernhard.messerklinger@br-automation.com> MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on BRSMTPINTERN2/InternSMTP(Build V1202_05192022|May 19, 2022) at 10/29/2024 09:54:29 AM, Serialize by Router on BRSMTPINTERN2/InternSMTP(Build V1202_05192022|May 19, 2022) at 10/29/2024 09:54:29 AM, Itemize by SMTP Server on BRSMTP01/Eggelsberg/AT/B&R(Release 14.0FP2 HF7|September 06, 2024) at 10/29/2024 09:54:28 AM, Serialize by Router on BRSMTP01/Eggelsberg/AT/B&R(Release 14.0FP2 HF7|September 06, 2024) at 10/29/2024 09:54:29 AM, Serialize complete at 10/29/2024 09:54:29 AM X-TNEFEvaluated: 1 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Now strlcpy is used to copy the defip string to the corresponding environment variable. This preserves memory for the NULL termination. Signed-off-by: Bernhard Messerklinger --- board/BuR/common/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c index 8aff821cfe..153761dd81 100644 --- a/board/BuR/common/common.c +++ b/board/BuR/common/common.c @@ -68,7 +68,7 @@ int brdefaultip_setup(int bus, int chip) "if test -r ${ipaddr}; then; else setenv ipaddr 192.168.60.%d; setenv serverip 192.168.60.254; setenv gatewayip 192.168.60.254; setenv netmask 255.255.255.0; fi;", u8buf); else - strncpy(defip, + strlcpy(defip, "if test -r ${ipaddr}; then; else setenv ipaddr 192.168.60.1; setenv serverip 192.168.60.254; setenv gatewayip 192.168.60.254; setenv netmask 255.255.255.0; fi;", sizeof(defip));