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 /common/parser.c | |
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 'common/parser.c')
-rw-r--r-- | common/parser.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/parser.c b/common/parser.c index fb9ef42e7f..584d4b0efe 100644 --- a/common/parser.c +++ b/common/parser.c @@ -270,7 +270,7 @@ int run_shell(void) login(); for (;;) { - len = readline (CONFIG_PROMPT, console_buffer, CONFIG_CBSIZE); + len = readline (CONFIG_PROMPT, console_buffer, CONFIG_CBSIZE - 1); if (len > 0) strcpy (lastcommand, console_buffer); |