Atoi() -> ParseInt() (#1256)

This commit is contained in:
mmetc 2022-02-14 14:00:42 +01:00 committed by GitHub
parent ef4bf6a8ab
commit 40ab8fa738
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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