From 0c3f5d0e0d9269ad47b8f4b061d7818993913189 Mon Sep 17 00:00:00 2001 From: Tatsuya Kinoshita Date: Mon, 14 Nov 2016 21:01:08 +0900 Subject: Prevent array index out of bounds for symbol Bug-Debian: https://github.com/tats/w3m/issues/38 --- display.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'display.c') diff --git a/display.c b/display.c index d4f336a..f1d6f99 100644 --- a/display.c +++ b/display.c @@ -1129,18 +1129,18 @@ addChar(char c, Lineprop mode) } #ifdef USE_M17N if (w == 2 && WcOption.use_wide) - addstr(graph2_symbol[(int)c]); + addstr(graph2_symbol[(unsigned char)c % N_GRAPH_SYMBOL]); else #endif - addch(*graph_symbol[(int)c]); + addch(*graph_symbol[(unsigned char)c % N_GRAPH_SYMBOL]); } else { #ifdef USE_M17N symbol = get_symbol(DisplayCharset, &w); - addstr(symbol[(int)c]); + addstr(symbol[(unsigned char)c % N_SYMBOL]); #else symbol = get_symbol(); - addch(*symbol[(int)c]); + addch(*symbol[(unsigned char)c % N_SYMBOL]); #endif } } -- cgit v1.2.3