diff options
author | Gabe Black <gabeblack@chromium.org> | 2011-08-12 18:38:09 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:59:36 -0700 |
commit | d91f8c4b97ffc8fcd1ddf6ee78172323cddf1652 (patch) | |
tree | 9b482f7ddbff0b570c7e914dffe2a45ee09fbccb /arch/x86 | |
parent | 29af2cb46e630a5c41555e97b4e8e154de1e8145 (diff) |
Change printf to puts to avoid a buffer overflow
printf as currently implemented in u-boot has a problem where it can overflow
an internal buffer if it prints an expanded string that's too long. Our command
lines are long enough to cause this problem. A fix is coming, but in the mean
time this change replaces a problematic printf with a few calls to puts that
have the same effect. This may perform slightly better because it should avoid
a copy and scanning for format specifiers. The amount of time it actually takes
up is very tiny relative to everything else so in practice that's probably
irrelevant.
BUG=none
TEST=Used vboot_twostop on an Alex and didn't see the buffer overflow problem.
Signed-off-by: Gabe Black <gabeblack@google.com>
Change-Id: I6ccd17b892c04dea673e289c582e85d53b3930e7
Reviewed-on: http://gerrit.chromium.org/gerrit/6271
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/lib/zimage.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index 80022d6b956..94b6e31203c 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -90,7 +90,9 @@ static void build_command_line(char *command_line, int auto_boot) } - printf("Kernel command line: \"%s\"\n", command_line); + puts("Kernel command line: \""); + puts(command_line); + puts("\"\n"); } static int kernel_magic_ok(struct setup_header *hdr) |