summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJan Weitzel <j.weitzel@phytec.de>2011-11-22 13:32:19 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-11-22 21:14:28 +0100
commit6df16cb90d237a6cbc43cea2ffe920e260264bb0 (patch)
treeca220556dcf3961697af7cabf23d1a18e7cec36d /lib
parent41ee1923e604c2583aceab2b32c4fe43187e1dc2 (diff)
downloadbarebox-6df16cb90d237a6cbc43cea2ffe920e260264bb0.tar.gz
barebox-6df16cb90d237a6cbc43cea2ffe920e260264bb0.tar.xz
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/readkey.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/readkey.c b/lib/readkey.c
index a42d1cb8ff..895db8214b 100644
--- a/lib/readkey.c
+++ b/lib/readkey.c
@@ -67,6 +67,8 @@ int read_key(void)
esc[i] = getc();
if (esc[i++] == '~')
break;
+ if (i == 5)
+ return -1;
}
}
esc[i] = 0;