]> git.sur5r.net Git - u-boot/commitdiff
Check for NULL prompt in readline_into_buffer()
authorPeter Tyser <ptyser@xes-inc.com>
Sun, 25 Oct 2009 20:12:52 +0000 (15:12 -0500)
committerWolfgang Denk <wd@denx.de>
Tue, 27 Oct 2009 19:58:25 +0000 (20:58 +0100)
Previously, passing readline() or readline_into_buffer() a NULL 'prompt'
parameter would result in puts() printing garbage when
CONFIG_CMDLINE_EDITING was enabled.

Note that no board currently triggers this bug.  Enabling
CONFIG_CMDLINE_EDITING on some boards (eg bab7xx) would result in
the bug appearing.  This change is only intended to prevent someone
from running into this issue in the future.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
common/main.c

index 026edd1db23a19de127fd4b29ec9e69e43f87c99..298982a48add712fa2a7032eb9b2ccb6c9770e5d 100644 (file)
@@ -964,7 +964,8 @@ int readline_into_buffer (const char *const prompt, char * buffer)
                        initted = 1;
                }
 
-               puts (prompt);
+               if (prompt)
+                       puts (prompt);
 
                rc = cread_line(prompt, p, &len);
                return rc < 0 ? rc : len;