fix check uid, gid values (#1309)

This commit is contained in:
mmetc 2022-03-07 10:16:34 +01:00 committed by GitHub
parent b66366c28c
commit e35efc5b2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -425,14 +425,14 @@ func getProcessAtr(username string, groupname string) (*syscall.SysProcAttr, err
if err != nil {
return nil, err
}
if uid < 0 && uid > math.MaxInt32 {
if uid < 0 || uid > math.MaxInt32 {
return nil, fmt.Errorf("out of bound uid")
}
gid, err := strconv.ParseInt(g.Gid, 10, 32)
if err != nil {
return nil, err
}
if gid < 0 && gid > math.MaxInt32 {
if gid < 0 || gid > math.MaxInt32 {
return nil, fmt.Errorf("out of bound gid")
}
return &syscall.SysProcAttr{