summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-10 00:15:11 +0200
committerwm4 <wm4@nowhere>2014-04-17 22:58:48 +0200
commit4a07120f83c7031cc15960fd3a4db8d72ff8b795 (patch)
tree82321ede2539656f411b6e94bfbb61cde3480189
parentd06ff691ede6dc9efc33773acbe6b4797147e831 (diff)
downloadmpv-4a07120f83c7031cc15960fd3a4db8d72ff8b795.tar.bz2
mpv-4a07120f83c7031cc15960fd3a4db8d72ff8b795.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 193cd8557f..7bb01495b9 100644
--- a/osdep/terminal-unix.c
+++ b/osdep/terminal-unix.c
@@ -86,6 +86,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)