Skip to content

Commit 8e14664

Browse files
Update cmd/yggdrasil/chuser_unix.go
Co-authored-by: VNAT <[email protected]>
1 parent fc5c13f commit 8e14664

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/yggdrasil/chuser_unix.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ func chuser(user string) error {
4949

5050
if g != nil {
5151
gid, _ := strconv.ParseUint(g.Gid, 10, 32)
52-
err := syscall.Setgid(int(uint32(gid)))
52+
var err error
53+
if gid < math.MaxInt {
54+
err = syscall.Setgid(int(gid))
55+
} else {
56+
err = errors.New("gid too big")
57+
}
58+
5359
if err != nil {
5460
return fmt.Errorf("failed to setgid %d: %v", gid, err)
5561
}

0 commit comments

Comments
 (0)