[ekg2-commit] ekg2: old.c (HEAD) [darkjames]

CVS commit cvs w amba.bydg.pdi.net
Nie, 25 Lut 2007, 18:10:26 CET


Module name:	ekg2
Changes by:	darkjames	07/02/25 18:10:23

Modified files:
	old.c

Log message:
fix
ncurses_binding_map[] / ncurses_binding_map_meta overflows.
occur @ rxvt, pressing ctrl+left
thx for rottencorpse

Index: old.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/old.c,v
diff -d -u -r1.131 -r1.132
--- old.c	16 Feb 2007 20:59:07 -0000	1.131
+++ old.c	25 Feb 2007 17:10:22 -0000	1.132
@@ -2112,11 +2112,13 @@
 	if (ch == 27) {
 		if ((ekg_getch(27, &ch)) < 0)
 			goto loop;
-/* XXX HERE we rather should check if ch is not larger than tabsize... */
-                b = ncurses_binding_map_meta[ch];
 		
 		if (ch == 27)
 			b = ncurses_binding_map[27];
+		else if (ch > KEY_MAX) {
+			debug_error("%s:%d INTERNAL NCURSES/EKG2 FAULT. KEY-PRESSED: %d>%d TO PROTECT FROM SIGSEGV\n", __FILE__, __LINE__, ch, KEY_MAX);
+			goto then;
+		} else	b = ncurses_binding_map_meta[ch];
 
 		/* jeśli dostaliśmy \033O to albo mamy Alt-O, albo
 		 * pokaleczone klawisze funkcyjne (\033OP do \033OS).
@@ -2160,6 +2162,16 @@
 	} else {
 		if (
 #if USE_UNICODE
+			!config_use_unicode && 
+#endif
+			ch > KEY_MAX) {
+			
+			debug_error("%s:%d INTERNAL NCURSES/EKG2 FAULT. KEY-PRESSED: %d>%d TO PROTECT FROM SIGSEGV\n", __FILE__, __LINE__, ch, KEY_MAX);
+			goto then;
+		}
+
+		if (
+#if USE_UNICODE
 			( (config_use_unicode && (tmp == KEY_CODE_YES || ch < 0x100 /* TODO CHECK */)) || !config_use_unicode) &&
 #endif
 			(b = ncurses_binding_map[ch]) && b->action) {


Więcej informacji o liście dyskusyjnej ekg2-commit