Prevent overflow beyond the end of string in visible_length_plain()

Bug-Debian: https://github.com/tats/w3m/issues/76
This commit is contained in:
Tatsuya Kinoshita
2016-12-10 17:32:49 +09:00
parent b4d27ba5cc
commit f763b8ebf5

View File

@@ -510,8 +510,9 @@ int
visible_length_plain(char *str)
{
int len = 0, max_len = 0;
char *strz = str + strlen(str);
while (*str) {
while (str < strz) {
if (*str == '\t') {
do {
len++;