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 --- symbol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'symbol.c') diff --git a/symbol.c b/symbol.c index 50475ae..c047c56 100644 --- a/symbol.c +++ b/symbol.c @@ -176,10 +176,10 @@ push_symbol(Str str, char symbol, int width, int n) #ifdef USE_M17N if (width == 2) - p = alt2_symbol[(int)symbol]; + p = alt2_symbol[(unsigned char)symbol % N_SYMBOL]; else #endif - p = alt_symbol[(int)symbol]; + p = alt_symbol[(unsigned char)symbol % N_SYMBOL]; for (i = 0; i < 2 && *p; i++, p++) buf[i] = (*p == ' ') ? NBSP_CODE : *p; -- cgit v1.2.3