]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
cmd_mtdparts.c: prevent printbuffer overflows
authorAnatolij Gustschin <agust@denx.de>
Tue, 23 Feb 2010 23:29:44 +0000 (00:29 +0100)
committerWolfgang Denk <wd@denx.de>
Thu, 11 Mar 2010 23:18:08 +0000 (00:18 +0100)
The length of configured MTDPARTS_DEFAULT string
could be greater than console printbuffer size.
Replace printf() by puts() to avoid potential buffer
overflows.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
common/cmd_mtdparts.c

index b375feaad190023e9c11c4084af495e8dbbddffb..20fed2aadce4e30f2b4808748a5a4a4c7cc1247b 100644 (file)
@@ -1254,8 +1254,14 @@ static void list_partitions(void)
        printf("\ndefaults:\n");
        printf("mtdids  : %s\n",
                mtdids_default ? mtdids_default : "none");
-       printf("mtdparts: %s\n",
-               mtdparts_default ? mtdparts_default : "none");
+       /*
+        * Using printf() here results in printbuffer overflow
+        * if default mtdparts string is greater than console
+        * printbuffer. Use puts() to prevent system crashes.
+        */
+       puts("mtdparts: ");
+       puts(mtdparts_default ? mtdparts_default : "none");
+       puts("\n");
 }
 
 /**