common: command: tempory buffer should have size of command line buf
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 19 Nov 2017 22:07:50 +0000 (23:07 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 30 Nov 2017 03:30:50 +0000 (22:30 -0500)
When copying the command line buffer the target array should
at least have the same size.

Cf. definition of console_buffer in common/cli_readline.c.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
common/command.c

index e5d9b9cf959c913304348f7147bb57f72ab53934..21a6d409fbaa09e5b5db966d7be24e46720d2a31 100644 (file)
@@ -318,7 +318,7 @@ static int find_common_prefix(char * const argv[])
        return len;
 }
 
-static char tmp_buf[CONFIG_SYS_CBSIZE];        /* copy of console I/O buffer   */
+static char tmp_buf[CONFIG_SYS_CBSIZE + 1];    /* copy of console I/O buffer */
 
 int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
 {