From 0cfa489cf08369e46c0a9cff2adcedd0fcb28659 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 22 Feb 2017 06:59:45 -0500 Subject: [PATCH] models/git_diff: add bound check --- models/git_diff.go | 4 +++- modules/bindata/bindata.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/models/git_diff.go b/models/git_diff.go index f61e88d47..005491194 100644 --- a/models/git_diff.go +++ b/models/git_diff.go @@ -366,8 +366,10 @@ func ParsePatch(maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) (* case strings.HasPrefix(line, "index"): if curFile.IsDeleted { curFile.Index = line[6:46] - } else { + } else if len(line) >= 88 { curFile.Index = line[49:88] + } else { + curFile.Index = curFile.Name } break CHECK_TYPE case strings.HasPrefix(line, "similarity index 100%"): diff --git a/modules/bindata/bindata.go b/modules/bindata/bindata.go index e6cea8cb9..e936a373d 100644 --- a/modules/bindata/bindata.go +++ b/modules/bindata/bindata.go @@ -307,7 +307,7 @@ func confAppIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/app.ini", size: 14876, mode: os.FileMode(420), modTime: time.Unix(1487726358, 0)} + info := bindataFileInfo{name: "conf/app.ini", size: 14876, mode: os.FileMode(420), modTime: time.Unix(1487727439, 0)} a := &asset{bytes: bytes, info: info} return a, nil }