diff mbox series

[1/4] board/BuR/common: use strlcpy instead of strncpy

Message ID 20241029085258.1740289-2-bernhard.messerklinger@br-automation.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series Update board/BuR/common to keep current mainline boards compatible | expand

Commit Message

Bernhard Messerklinger Oct. 29, 2024, 8:52 a.m. UTC
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@br-automation.com>
---

 board/BuR/common/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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));