0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-23 07:43:18 -05:00

swap \n for \000, update len check, when reading receive-pack input

This commit is contained in:
Christopher Brickley 2014-04-15 22:07:28 -04:00
parent c3a52f7dd0
commit 4c5a6e4d87

View file

@ -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]