summaryrefslogtreecommitdiffstats
path: root/common/hush.c
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-03-22 07:55:26 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2021-03-22 10:18:42 +0100
commitb09a15ce42f344bd4f4f67ab509b774274920e2c (patch)
tree3325b9afad25551274a2f9b589ad25aec61be1f8 /common/hush.c
parentca2cc1e48bbcbc9b3d20d20d859e6d2dc351ec36 (diff)
downloadbarebox-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/hush.c')
-rw-r--r--common/hush.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/hush.c b/common/hush.c
index 763e6cf74b..0475401321 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -451,7 +451,7 @@ static void get_user_input(struct in_str *i)
command_slice_release();
- n = readline(prompt, console_buffer, CONFIG_CBSIZE);
+ n = readline(prompt, console_buffer, CONFIG_CBSIZE - 1);
command_slice_acquire();