9
0
Fork 0

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>
This commit is contained in:
Sascha Hauer 2015-12-14 14:41:26 +01:00
parent 85464314b1
commit e3ae12a418
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}