From 167d39a95a610cf8713ae9d943fe0533ffa62ecd Mon Sep 17 00:00:00 2001 From: thediveo Date: Thu, 9 Nov 2023 12:04:11 +0000 Subject: [PATCH] fix: work around codeql issue 14733/9295 Signed-off-by: thediveo --- network/netns_tuntap.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/network/netns_tuntap.go b/network/netns_tuntap.go index cdb83a7..de87e08 100644 --- a/network/netns_tuntap.go +++ b/network/netns_tuntap.go @@ -89,8 +89,11 @@ func discoverProcessors(allprocs model.ProcessTable) []tuntapProcessor { } } - fd, err := strconv.ParseUint(fdInfoEntry.Name(), 10, strconv.IntSize-1) - if err != nil { + // Work around bug(s) #14733/#9295 in CodeQL scanning which + // currently block correct parsing using ParseUint(..., + // strconv.IntSize-1) and then casting to int. + fd, err := strconv.ParseInt(fdInfoEntry.Name(), 10, strconv.IntSize) + if err != nil || fd < 0 { continue } taptunFd, err := unix.PidfdGetfd(pidfd, int(fd), 0)