summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-10 00:15:11 +0200
committerwm4 <wm4@nowhere>2014-04-10 00:18:26 +0200
commitf0e08c01ff325ab8b7140884bc1364f548c060fc (patch)
tree3771799958ecaa7f4671f66267ef4e95b4b9370c
parent39b2e206985d5adf99f182f9338d5267c36fea30 (diff)
downloadmpv-f0e08c01ff325ab8b7140884bc1364f548c060fc.tar.bz2
mpv-f0e08c01ff325ab8b7140884bc1364f548c060fc.tar.xz
terminal-unix: reject overlong termcap strings
Our own tables have size for only 8 chars, so these sequences must be rejected. It seems strings of length 8 are still ok, because the code uses memcmp and not strcmp, so still allow these. Based on mplayer-svn commit r37129.
-rw-r--r--osdep/terminal-unix.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/osdep/terminal-unix.c b/osdep/terminal-unix.c
index 19e2caf7b2..9b1e3d21fe 100644
--- a/osdep/terminal-unix.c
+++ b/osdep/terminal-unix.c
@@ -87,6 +87,9 @@ static char *term_smkx = NULL;
#endif
static keycode_st *keys_push(char *p, int code) {
+ if (strlen(p) > 8)
+ return NULL;
+
if (getch2_keys.len == getch2_keys.cap) {
getch2_keys.cap *= 2;
if (getch2_keys.cap == 0)