Skip to content

Commit

Permalink
fix: catches nil package to resolve panic in TaintAnalyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
smoyer64 committed Dec 31, 2022
1 parent 3d38a9a commit c16e2fb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions util/taint.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type TaintedCode struct {
ParentFunction string
}

//MapData is a struct that contains information about each hash
// MapData is a struct that contains information about each hash
type MapData struct {
Mapped bool // whether a hash has already been mapped
Vulnerable bool // whether a hash has been found vulnerable
Expand Down Expand Up @@ -172,7 +172,10 @@ func (ta *TaintAnalyzer) ContainsTaintRecurse(startCall *ssa.CallCommon, val *ss
case *ssa.Call:
callFunc, ok := (expr.Call.Value).(*ssa.Function)
if ok {
globalPkgName := callFunc.Pkg.Pkg.Name()
globalPkgName := ""
if callFunc.Pkg != nil {
globalPkgName = callFunc.Pkg.Pkg.Name()
}
if val, ok := VulnGlobalFuncs[globalPkgName]; ok {
for _, funcName := range val {
if callFunc.Name() == funcName {
Expand Down

0 comments on commit c16e2fb

Please sign in to comment.