Prevent overflow beyond the end of string in skip_space()

Bug-Debian: https://github.com/tats/w3m/issues/74
This commit is contained in:
Tatsuya Kinoshita
2016-12-08 23:51:09 +09:00
parent a932f78a6d
commit e757b43bcf

View File

@@ -2251,6 +2251,7 @@ skip_space(struct table *t, char *line, struct table_linfo *linfo,
Str prevchar = linfo->prevchar;
int w = linfo->length;
int min = 1;
char *linez;
if (*line == '<' && line[strlen(line) - 1] == '>') {
if (checkminimum)
@@ -2258,7 +2259,8 @@ skip_space(struct table *t, char *line, struct table_linfo *linfo,
return 0;
}
while (*line) {
linez = line + strlen(line);
while (line < linez) {
char *save = line, *c = line;
int ec, len, wlen, plen;
ctype = get_mctype(line);