all repos — legit @ d5a33e9150da61d95ad3ae06f6754a6dd101124a

web frontend for git, written in go

fix buffer overflow in countlines for files greater than 32k

Signed-off-by: Derek Stevens <nilix@nilfm.cc>
Derek Stevens nilix@nilfm.cc
Sun, 05 Feb 2023 09:50:53 -0700
commit

d5a33e9150da61d95ad3ae06f6754a6dd101124a

parent

c90b2b51931423e8161dabe88c4c5c11ba204872

1 files changed, 1 insertions(+), 1 deletions(-)

jump to
M routes/template.goroutes/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