Skip to content

Commit

Permalink
fix(go-binary): skip large files (fanal#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
afdesk authored Sep 30, 2021
1 parent 843813c commit 96f7cc7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion analyzer/language/golang/binary/binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ func init() {
analyzer.RegisterAnalyzer(&gobinaryLibraryAnalyzer{})
}

const version = 1
const (
version = 1
MiB = 1024 * 1024
MaxFileSize = 200 * MiB
)

type gobinaryLibraryAnalyzer struct{}

Expand All @@ -36,6 +40,9 @@ func (a gobinaryLibraryAnalyzer) Required(_ string, fileInfo os.FileInfo) bool {
return false
}

if fileInfo.Size() > MaxFileSize {
return false
}
// Check executable file
if mode.Perm()&0111 != 0 {
return true
Expand Down

0 comments on commit 96f7cc7

Please sign in to comment.