aboutsummaryrefslogtreecommitdiffstats
path: root/display.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2016-11-14 12:01:08 +0000
committerTatsuya Kinoshita <tats@debian.org>2016-11-19 12:25:59 +0000
commit500e08adcd54bc033a97710aadc844bcea143be1 (patch)
tree087a1b7b70c7c4430eb324c45dc09a1f24a1ef60 /display.c
parentCheck indent_level to prevent infinite recursion (diff)
downloadw3m-500e08adcd54bc033a97710aadc844bcea143be1.tar.gz
w3m-500e08adcd54bc033a97710aadc844bcea143be1.zip
Prevent array index out of bounds for symbol
Bug-Debian: https://github.com/tats/w3m/issues/38 Origin: https://anonscm.debian.org/cgit/collab-maint/w3m.git/commit/?id=0c3f5d0e0d9269ad47b8f4b061d7818993913189
Diffstat (limited to 'display.c')
-rw-r--r--display.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/display.c b/display.c
index 2fe1183..e505eb7 100644
--- a/display.c
+++ b/display.c
@@ -1119,18 +1119,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
}
}