From: Anatolij Gustschin Date: Tue, 23 Feb 2010 23:29:44 +0000 (+0100) Subject: cmd_mtdparts.c: prevent printbuffer overflows X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=a693447ceadff49155e260cbbaef4e09c926cab5;p=u-boot.git cmd_mtdparts.c: prevent printbuffer overflows 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 --- diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index b375feaad1..20fed2aadc 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -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"); } /**