[MPlayer-cvslog] r37129 - trunk/osdep/getch2.c
reimar
subversion at mplayerhq.hu
Sun Apr 6 20:10:31 CEST 2014
Author: reimar
Date: Sun Apr 6 20:10:31 2014
New Revision: 37129
Log:
Fix handling of overlong termcap strings entries.
The previous code would silently truncate and then
read out of bounds later in a memcmp.
Modified:
trunk/osdep/getch2.c
Modified: trunk/osdep/getch2.c
==============================================================================
--- trunk/osdep/getch2.c Sun Apr 6 19:57:33 2014 (r37128)
+++ trunk/osdep/getch2.c Sun Apr 6 20:10:31 2014 (r37129)
@@ -100,7 +100,12 @@ char *p=tgetstr(id,&term_p);
if(!p) return;
if(getch2_key_db>=MAX_KEYS) return;
getch2_keys[getch2_key_db].len=strlen(p);
- strncpy(getch2_keys[getch2_key_db].chars,p,8);
+ if (getch2_keys[getch2_key_db].len >= sizeof(getch2_keys[getch2_key_db].chars))
+ {
+ printf("Key string entry more than 7 characters, ignoring\n");
+ return;
+ }
+ strcpy(getch2_keys[getch2_key_db].chars,p);
getch2_keys[getch2_key_db].code=code;
++getch2_key_db;
/* printf("%s=%s\n",id,p); */
More information about the MPlayer-cvslog
mailing list