Skip to content

Commit 5f9284c

Browse files
committed
Check for negative gid
Signed-off-by: Michael Crosby <[email protected]>
1 parent f55f79d commit 5f9284c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

exec.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) {
213213
p.User.UID = uint32(uid)
214214
}
215215
for _, gid := range context.Int64Slice("additional-gids") {
216+
if gid < 0 {
217+
return nil, fmt.Errorf("additional-gids must be a positive number %d", gid)
218+
}
216219
p.User.AdditionalGids = append(p.User.AdditionalGids, uint32(gid))
217220
}
218221
return p, nil

tests/integration/exec.bats

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ function teardown() {
114114
}
115115

116116
@test "runc exec --additional-gids" {
117+
requires root
118+
117119
# run busybox detached
118120
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
119121
[ "$status" -eq 0 ]

0 commit comments

Comments
 (0)