Skip to content

Commit cb29747

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

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
@@ -69,7 +69,13 @@ func chuser(user string) error {
6969

7070
if u != nil {
7171
uid, _ := strconv.ParseUint(u.Uid, 10, 32)
72-
err := syscall.Setuid(int(uint32(uid)))
72+
var err error
73+
if uid < math.MaxInt {
74+
err = syscall.Setuid(int(uid))
75+
} else {
76+
err = errors.New("uid too big")
77+
}
78+
7379
if err != nil {
7480
return fmt.Errorf("failed to setuid %d: %v", uid, err)
7581
}

0 commit comments

Comments
 (0)