mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-23 15:37:50 -08:00
Check errors passed through by filepath.Walk (#208)
In several files, the error passed from filepath.Walk to WalkFunc is not checked. As the info argument to WalkFn is nil in case of an error, accessing info can cause a runtime panic. This commit adds checks for errors passed through to WalkFunc.
This commit is contained in:
committed by
Teppei Fukuda
parent
cb1870e7bf
commit
f198b6eb63
@@ -59,6 +59,9 @@ func CloneOrPull(url, repoPath string) (map[string]struct{}, error) {
|
||||
// Need to refresh all vulnerabilities
|
||||
if db.GetVersion() == "" {
|
||||
err = filepath.Walk(repoPath, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user