[PATCH 1/4] board/BuR/common: use strlcpy instead of strncpy
Bernhard Messerklinger
bernhard.messerklinger at br-automation.com
Tue Oct 29 09:52:09 CET 2024
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 <bernhard.messerklinger at br-automation.com>
---
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));
--
2.46.1
More information about the U-Boot
mailing list