Skip to content

Commit 972439d

Browse files
committed
[FIX] Security issues
1 parent b3ca668 commit 972439d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: utils/bash.go

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package utils
22

33
import (
4+
"math"
45
"os"
56
"os/exec"
67
"os/user"
@@ -24,11 +25,18 @@ func GetUserUIDs(username string) (uint32, uint32, error) {
2425
if err != nil {
2526
return 0, 0, err
2627
}
28+
if uid < 0 || uid > math.MaxUint32 {
29+
uid = 0
30+
}
2731

2832
gid, err := strconv.Atoi(u.Gid)
2933
if err != nil {
3034
return 0, 0, err
3135
}
36+
if gid < 0 || uid > math.MaxUint32 {
37+
gid = 0
38+
}
39+
3240
return uint32(uid), uint32(gid), nil
3341
}
3442

0 commit comments

Comments
 (0)