]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_pxe.c
dm: usb: Move storage device scanning into its own function
[karo-tx-uboot.git] / common / cmd_pxe.c
index 0ab1e0aaa63fa13e8b60a78ea3b7fb1a9698b293..96f963ddd77606d9fe9a23dd8853e198c059d07f 100644 (file)
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
 #include <errno.h>
@@ -674,6 +675,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);