mirror of
https://github.com/gogs/gogs.git
synced 2026-05-07 12:27:06 +02:00
models/repo_editor: sanitize user-defined file name to prevent RCE (#5558)
Reported by PentesterLab (https://pentesterlab.com).
This commit is contained in:
@@ -328,7 +328,7 @@ func (upload *Upload) LocalPath() string {
|
||||
func NewUpload(name string, buf []byte, file multipart.File) (_ *Upload, err error) {
|
||||
upload := &Upload{
|
||||
UUID: gouuid.NewV4().String(),
|
||||
Name: name,
|
||||
Name: tool.SanitizePath(name),
|
||||
}
|
||||
|
||||
localPath := upload.LocalPath()
|
||||
|
||||
Reference in New Issue
Block a user