Skip to content

Commit

Permalink
make big codeql happy
Browse files Browse the repository at this point in the history
  • Loading branch information
axtloss committed Aug 10, 2024
1 parent 692086e commit 300fea0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package core

import (
"fmt"
"math"
"os"
"os/exec"
"syscall"
Expand Down Expand Up @@ -72,7 +73,11 @@ func compileDocker(recipe api.Recipe, gid int, uid int) error {
cmd.Stderr = os.Stderr
cmd.Dir = recipe.ParentPath
cmd.SysProcAttr = &syscall.SysProcAttr{}
cmd.SysProcAttr.Credential = &syscall.Credential{Uid: uint32(uid), Gid: uint32(gid)}
if uid > 0 && uid <= math.MaxUint32 && gid > 0 && gid <= math.MaxUint32 {
cmd.SysProcAttr.Credential = &syscall.Credential{Uid: uint32(uid), Gid: uint32(gid)}
} else {
return fmt.Errorf("uid and gid exceed uint32")
}

return cmd.Run()
}
Expand Down

0 comments on commit 300fea0

Please sign in to comment.