diff options
author | Anatolij Gustschin | 2010-02-24 00:29:44 +0100 |
---|---|---|
committer | Wolfgang Denk | 2010-03-12 00:18:08 +0100 |
commit | a693447ceadff49155e260cbbaef4e09c926cab5 (patch) | |
tree | cebd86b50e6af4e8e020b6c55df8f81e50dfed33 | |
parent | 3920bbedcf74a073bc72950a51de75af6faa2f06 (diff) |
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 <agust@denx.de>
-rw-r--r-- | common/cmd_mtdparts.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index b375feaad19..20fed2aadce 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"); } /** |