fix buffer overflow in countlines for files greater than 32k Signed-off-by: Derek Stevens <nilix@nilfm.cc>
1 file changed, 1 insertion(+), 1 deletion(-)
jump to
M routes/template.go → routes/template.go
@@ -59,7 +59,7 @@ switch { case err == io.EOF: /* handle last line not having a newline at the end */ - if bufLen >= 1 && buf[bufLen-1] != '\n' { + if bufLen >= 1 && buf[(bufLen-1)%(32*1024)] != '\n' { count++ } return count, nil