9
0
Fork 0

readkey: force return from while true

If read_key is feeded by STRG + KEY_LEFT you run into the while(1)
loop and corrupt memory through esc array.
Force return if index gets too high.

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Jan Weitzel 2011-11-22 13:32:19 +01:00 committed by Sascha Hauer
parent 41ee1923e6
commit 6df16cb90d
1 changed files with 2 additions and 0 deletions

View File

@ -67,6 +67,8 @@ int read_key(void)
esc[i] = getc();
if (esc[i++] == '~')
break;
if (i == 5)
return -1;
}
}
esc[i] = 0;