From: Bernhard Messerklinger Date: Fri, 4 Apr 2025 07:27:57 +0000 (+0200) Subject: board/BuR/common: use strlcpy instead of strncpy X-Git-Tag: v2025.07-rc1~52^2~3 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=970152e4d1d0a839bf004e701ced597e8fc23237;p=pandora-u-boot.git board/BuR/common: use strlcpy instead of strncpy 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 Link: https://lore.kernel.org/r/20250404072819.69642-2-bernhard.messerklinger@br-automation.com Signed-off-by: Michal Simek --- diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c index 7fb61736710..3513f43a9f5 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));