diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-12-14 14:41:26 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-01-08 08:30:56 +0100 |
commit | e3ae12a4185e1dc61f62bec90db12b1fc3dc906c (patch) | |
tree | 28aad25d032ec52401f0f68655eef3ff135fab3a /lib/readline.c | |
parent | 85464314b18472656bfab6435b33aac3a63dca04 (diff) | |
download | barebox-e3ae12a4185e1dc61f62bec90db12b1fc3dc906c.tar.gz barebox-e3ae12a4185e1dc61f62bec90db12b1fc3dc906c.tar.xz |
readline: Fix potential buffer overflow
cread_add_char doesn't take the trailing '\0' into account, so adding
it at the end of readline can overflow the buffer.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib/readline.c')
-rw-r--r-- | lib/readline.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/readline.c b/lib/readline.c index c007e10f50..4c9bb760d3 100644 --- a/lib/readline.c +++ b/lib/readline.c @@ -150,7 +150,7 @@ static void cread_add_char(char ichar, int insert, unsigned long *num, /* room ??? */ if (insert || *num == *eol_num) { - if (*eol_num > len - 1) { + if (*eol_num > len - 2) { getcmd_cbeep(); return; } |