diff options
author | Christopher Brickley <brickley@gmail.com> | 2014-04-15 22:07:28 -0400 |
---|---|---|
committer | Christopher Brickley <brickley@gmail.com> | 2014-04-15 22:07:28 -0400 |
commit | 4c5a6e4d8782a0bb301b214aac1b86de2062a49b (patch) | |
tree | ac6224fdfbc558c8bdaf158e177106710fed915f /routers | |
parent | c3a52f7dd075f1f3cf7fb935b7489629760837ab (diff) | |
download | gitea-4c5a6e4d8782a0bb301b214aac1b86de2062a49b.tar.gz gitea-4c5a6e4d8782a0bb301b214aac1b86de2062a49b.zip |
swap \n for \000, update len check, when reading receive-pack input
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/http.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go index ab48c6f3d7..2f41b65d13 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -119,10 +119,10 @@ func Http(ctx *middleware.Context, params martini.Params) { config := Config{base.RepoRootPath, "git", true, true, func(rpc string, input []byte) { if rpc == "receive-pack" { - firstLine := bytes.IndexRune(input, '\n') + firstLine := bytes.IndexRune(input, '\000') if firstLine > -1 { fields := strings.Fields(string(input[:firstLine])) - if len(fields) > 3 { + if len(fields) == 3 { oldCommitId := fields[0][4:] newCommitId := fields[1] refName := fields[2] |