aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-10-24 23:12:43 +0200
committerGitHub <noreply@github.com>2021-10-24 22:12:43 +0100
commitf99d50fc9f8baf406f32a491b214f8a13617d086 (patch)
treeb3cd8a1304e522f111690e9f68130e663012bb16 /modules/git
parent932780c2bbae09f052e2fcd1a0701966483496e8 (diff)
downloadgitea-f99d50fc9f8baf406f32a491b214f8a13617d086.tar.gz
gitea-f99d50fc9f8baf406f32a491b214f8a13617d086.zip
Read expected buffer size (#17409)
* Read expected buffer size. * Changed name.
Diffstat (limited to 'modules/git')
-rw-r--r--modules/git/blob.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/git/blob.go b/modules/git/blob.go
index c7919f3c41..9567affd03 100644
--- a/modules/git/blob.go
+++ b/modules/git/blob.go
@@ -11,6 +11,7 @@ import (
"io"
"code.gitea.io/gitea/modules/typesniffer"
+ "code.gitea.io/gitea/modules/util"
)
// This file contains common functions between the gogit and !gogit variants for git Blobs
@@ -28,7 +29,7 @@ func (b *Blob) GetBlobContent() (string, error) {
}
defer dataRc.Close()
buf := make([]byte, 1024)
- n, _ := dataRc.Read(buf)
+ n, _ := util.ReadAtMost(dataRc, buf)
buf = buf[:n]
return string(buf), nil
}