summaryrefslogtreecommitdiff
path: root/common/cmd_pxe.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/cmd_pxe.c')
-rw-r--r--common/cmd_pxe.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 0ab1e0aaa6..7e32c95df3 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -674,6 +674,15 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
char bootargs[CONFIG_SYS_CBSIZE] = "";
char finalbootargs[CONFIG_SYS_CBSIZE];
+ if (strlen(label->append ?: "") +
+ strlen(ip_str) + strlen(mac_str) + 1 > sizeof(bootargs)) {
+ printf("bootarg overflow %zd+%zd+%zd+1 > %zd\n",
+ strlen(label->append ?: ""),
+ strlen(ip_str), strlen(mac_str),
+ sizeof(bootargs));
+ return 1;
+ }
+
if (label->append)
strcpy(bootargs, label->append);
strcat(bootargs, ip_str);