Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

fix: catches nil package to resolve panic in TaintAnalyzer #84

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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