mirror of
https://github.com/gogs/gogs.git
synced 2025-05-25 00:40:40 +00:00
models/git_diff: add bound check
This commit is contained in:
parent
e0af5c280d
commit
0cfa489cf0
@ -366,8 +366,10 @@ func ParsePatch(maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) (*
|
|||||||
case strings.HasPrefix(line, "index"):
|
case strings.HasPrefix(line, "index"):
|
||||||
if curFile.IsDeleted {
|
if curFile.IsDeleted {
|
||||||
curFile.Index = line[6:46]
|
curFile.Index = line[6:46]
|
||||||
} else {
|
} else if len(line) >= 88 {
|
||||||
curFile.Index = line[49:88]
|
curFile.Index = line[49:88]
|
||||||
|
} else {
|
||||||
|
curFile.Index = curFile.Name
|
||||||
}
|
}
|
||||||
break CHECK_TYPE
|
break CHECK_TYPE
|
||||||
case strings.HasPrefix(line, "similarity index 100%"):
|
case strings.HasPrefix(line, "similarity index 100%"):
|
||||||
|
@ -307,7 +307,7 @@ func confAppIni() (*asset, error) {
|
|||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user