diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-03-22 07:55:26 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-03-22 10:18:42 +0100 |
commit | b09a15ce42f344bd4f4f67ab509b774274920e2c (patch) | |
tree | 3325b9afad25551274a2f9b589ad25aec61be1f8 /commands | |
parent | ca2cc1e48bbcbc9b3d20d20d859e6d2dc351ec36 (diff) | |
download | barebox-b09a15ce42f344bd4f4f67ab509b774274920e2c.tar.gz barebox-b09a15ce42f344bd4f4f67ab509b774274920e2c.tar.xz |
common: readline: fix possible buffer overflows
Entering very long lines can crash the readline prompt due to missing
NUL terminator. Make sure we don't exceed CONFIG_CBSIZE to avoid this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/readline.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/commands/readline.c b/commands/readline.c index 7933a58c08..57c8fbd7bc 100644 --- a/commands/readline.c +++ b/commands/readline.c @@ -19,7 +19,7 @@ static int do_readline(int argc, char *argv[]) command_slice_release(); - if (readline(argv[1], buf, CONFIG_CBSIZE) < 0) { + if (readline(argv[1], buf, CONFIG_CBSIZE - 1) < 0) { command_slice_acquire(); free(buf); return COMMAND_ERROR; |