mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
add a test case for UID/GID limits
This commit is contained in:
@@ -822,7 +822,7 @@ func (u *User) GetFsConfigAsJSON() ([]byte, error) {
|
||||
|
||||
// GetUID returns a validate uid, suitable for use with os.Chown
|
||||
func (u *User) GetUID() int {
|
||||
if u.UID <= 0 || u.UID > int(math.Pow(2, 31))-1 {
|
||||
if u.UID <= 0 || u.UID > math.MaxInt32 {
|
||||
return -1
|
||||
}
|
||||
return u.UID
|
||||
@@ -830,7 +830,7 @@ func (u *User) GetUID() int {
|
||||
|
||||
// GetGID returns a validate gid, suitable for use with os.Chown
|
||||
func (u *User) GetGID() int {
|
||||
if u.GID <= 0 || u.GID > int(math.Pow(2, 31))-1 {
|
||||
if u.GID <= 0 || u.GID > math.MaxInt32 {
|
||||
return -1
|
||||
}
|
||||
return u.GID
|
||||
|
||||
Reference in New Issue
Block a user