fix: make CodeQL happy Dreamacro
This commit is contained in:
parent
e488342451
commit
58e44ed27c
2 changed files with 4 additions and 4 deletions
|
@ -72,14 +72,14 @@ func (u *Uid) RuleType() C.RuleType {
|
|||
}
|
||||
|
||||
func (u *Uid) Match(metadata *C.Metadata) bool {
|
||||
srcPort, err := strconv.Atoi(metadata.SrcPort)
|
||||
srcPort, err := strconv.ParseUint(metadata.SrcPort, 10, 16)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
var uid int32
|
||||
if metadata.Uid != nil {
|
||||
uid = *metadata.Uid
|
||||
} else if uid, err = process.FindUid(metadata.NetWork.String(), metadata.SrcIP, srcPort); err == nil {
|
||||
} else if uid, err = process.FindUid(metadata.NetWork.String(), metadata.SrcIP, int(srcPort)); err == nil {
|
||||
metadata.Uid = &uid
|
||||
} else {
|
||||
log.Warnln("[UID] could not get uid from %s", metadata.String())
|
||||
|
|
|
@ -181,9 +181,9 @@ func preHandleMetadata(metadata *C.Metadata) error {
|
|||
}
|
||||
|
||||
// pre resolve process name
|
||||
srcPort, err := strconv.Atoi(metadata.SrcPort)
|
||||
srcPort, err := strconv.ParseUint(metadata.SrcPort, 10, 16)
|
||||
if err == nil && P.ShouldFindProcess(metadata) {
|
||||
uid, path, err := P.FindProcessName(metadata.NetWork.String(), metadata.SrcIP, srcPort)
|
||||
uid, path, err := P.FindProcessName(metadata.NetWork.String(), metadata.SrcIP, int(srcPort))
|
||||
if err != nil {
|
||||
if failTotal < 20 {
|
||||
log.Debugln("[Process] find process %s: %v", metadata.String(), err)
|
||||
|
|
Loading…
Reference in a new issue