+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ver := $(shell git log -1 --pretty=format:%h)

compile:
echo $(ver)
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.GitCommit=$(ver)" -o build/tonutils-storage-linux-amd64 cli/main.go
GOOS=linux GOARCH=arm64 go build -ldflags "-X main.GitCommit=$(ver)" -o build/tonutils-storage-linux-arm64 cli/main.go
GOOS=darwin GOARCH=arm64 go build -ldflags "-X main.GitCommit=$(ver)" -o build/tonutils-storage-mac-arm64 cli/main.go
Expand Down
11 changes: 11 additions & 0 deletions storage/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/hex"
"fmt"
"sort"
"strings"
"time"
)

Expand Down Expand Up @@ -214,6 +215,11 @@ func (t *Torrent) startDownload(report func(Event)) error {
continue
}

if strings.Contains(file.Name, "..") {
Logger("Malicious file with path traversal was skipped: " + file.Name)
continue
}

err = func() error {
f, err := t.db.GetFS().Open(rootPath+"/"+file.Name, OpenModeWrite)
if err != nil {
Expand Down Expand Up @@ -297,6 +303,11 @@ func writeOrdered(ctx context.Context, t *Torrent, list []fileInfo, piecesMap ma
var currentPiece, currentProof []byte
for _, off := range list {
err := func() error {
if strings.Contains(off.path, "..") {
Logger("Malicious file with path traversal was skipped: " + off.path)
return fmt.Errorf("malicious file")
}

f, err := t.db.GetFS().Open(rootPath+"/"+off.path, OpenModeWrite)
if err != nil {
return fmt.Errorf("failed to create file %s: %w", off.path, err)
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载