mdocml: cgi.c makes wrong usage of fgetln(3).
Issue #97
resolved
see following code:
609 while (NULL != (p = fgetln(f, &len))) {
...
611 for (i = 0; i < (int)len - 1; i++) {
...
618 if ('\b' == p[i] || '\n' == p[i])
...
712 if (i == (int)len - 1 && '\n' != p[i])
713 html_putchar(p[i]);
...
line 611, assume always string is end with '\n' and substruct -1 from len, it is wrong so line 712, try to fix something wrong with this assumotion, it is quit bogus.
and line 618, fgetln(3) never returns string that contains '\n' before len - 1, completely useless check.
Comments (2)
-
reporter -
reporter - changed status to resolved
BUGFIX: Issue
#97- mdocml: cgi.c makes wrong usage of fgetln(3).→ <<cset 6cd96248c4e0>>
- Log in to comment
and more, fgetln(3) is not portable, use POSIX getline(3) instead.