diff options
author | Derek Stevens <nilix@nilfm.cc> | 2023-02-05 09:50:53 -0700 |
---|---|---|
committer | Anirudh Oppiliappan <x@icyphox.sh> | 2023-02-18 14:17:47 +0530 |
commit | d5a33e9150da61d95ad3ae06f6754a6dd101124a (patch) | |
tree | 4ac9216eb09fdcefbb1949c8d33944e05e5e735b /routes | |
parent | c90b2b51931423e8161dabe88c4c5c11ba204872 (diff) | |
download | legit-d5a33e9150da61d95ad3ae06f6754a6dd101124a.tar.gz legit-d5a33e9150da61d95ad3ae06f6754a6dd101124a.tar.bz2 legit-d5a33e9150da61d95ad3ae06f6754a6dd101124a.zip |
fix buffer overflow in countlines for files greater than 32k
Signed-off-by: Derek Stevens <nilix@nilfm.cc>
Diffstat (limited to '')
-rw-r--r-- | routes/template.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/routes/template.go b/routes/template.go index 408841a..20d678b 100644 --- a/routes/template.go +++ b/routes/template.go @@ -59,7 +59,7 @@ func countLines(r io.Reader) (int, error) { 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 |