Skip to content
Snippets Groups Projects
Commit bf297492 authored by rswindell's avatar rswindell
Browse files

Fix off-by-two issue with fgets() calls in printfile() line-at-a-time mode

(new). Reported by Alterego (ALTERANT)
parent c65542f8
No related branches found
No related tags found
No related merge requests found
......@@ -128,9 +128,8 @@ bool sbbs_t::printfile(const char* fname, long mode, long org_cols)
return false;
}
while(!feof(stream) && !msgabort()) {
if(fgets(buf, length-1, stream) == NULL)
if(fgets(buf, length + 1, stream) == NULL)
break;
buf[length] = 0;
if((mode&P_UTF8) && !term_supports(UTF8))
utf8_normalize_str(buf);
putmsg(buf, mode, org_cols);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment