From 4a07120f83c7031cc15960fd3a4db8d72ff8b795 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 10 Apr 2014 00:15:11 +0200 Subject: [PATCH] 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. --- osdep/terminal-unix.c | 3 +++ 1 file changed, 3 insertions(+) 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)