U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Bernhard Messerklinger" <bernhard.messerklinger@br-automation.com>
To: u-boot@lists.denx.de
Cc: "Bernhard Messerklinger"
	<bernhard.messerklinger@br-automation.com>,
	"Simon Glass" <sjg@chromium.org>, "Tom Rini" <trini@konsulko.com>,
	"Wolfgang Wallner" <wolfgang.wallner@br-automation.com>
Subject: [PATCH v4 1/4] board/BuR/common: use strlcpy instead of strncpy
Date: Fri, 4 Apr 2025 09:27:57 +0200	[thread overview]
Message-ID: <20250404072819.69642-2-bernhard.messerklinger@br-automation.com> (raw)
In-Reply-To: <20250404072819.69642-1-bernhard.messerklinger@br-automation.com>

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

(no changes since v1)

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


  reply	other threads:[~2025-04-05 15:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-04  7:27 [PATCH v4 0/4] Add support for BR Xilinx Zynq boards in mainline U-Boot Bernhard Messerklinger
2025-04-04  7:27 ` Bernhard Messerklinger [this message]
2025-04-04  7:27 ` [PATCH v4 2/4] board/BuR/common: add parameter for reset controller I2C bus selection Bernhard Messerklinger
2025-04-04  7:27 ` [PATCH v4 3/4] board/BuR/common: split br_resetc_bmode function Bernhard Messerklinger
2025-04-04  7:28 ` [PATCH v4 4/4] board/BuR/zynq: initial commit Bernhard Messerklinger
2025-04-14  6:48   ` Michal Simek
2025-04-17 10:11 ` [PATCH v4 0/4] Add support for BR Xilinx Zynq boards in mainline U-Boot Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250404072819.69642-2-bernhard.messerklinger@br-automation.com \
    --to=bernhard.messerklinger@br-automation.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=wolfgang.wallner@br-automation.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox