[PATCH v2 10/16] pxe: Use strlcpy() instead of strcpy() in label_boot()

Simon Glass sjg at chromium.org
Fri Dec 15 05:19:08 CET 2023


The intention here is to nul-terminate the result string, so use the
correct function for that.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2:
- Split out the strlcpy() change into its own patch

 boot/pxe_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index a92bb896c63e..2c87aba7ed33 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -593,7 +593,7 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
 		}
 
 		if (label->append)
-			strncpy(bootargs, label->append, sizeof(bootargs));
+			strlcpy(bootargs, label->append, sizeof(bootargs));
 
 		strcat(bootargs, ip_str);
 		strcat(bootargs, mac_str);
-- 
2.43.0.472.g3155946c3a-goog



More information about the U-Boot mailing list