mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
Check for negative gid
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -213,6 +213,9 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) {
|
||||
p.User.UID = uint32(uid)
|
||||
}
|
||||
for _, gid := range context.Int64Slice("additional-gids") {
|
||||
if gid < 0 {
|
||||
return nil, fmt.Errorf("additional-gids must be a positive number %d", gid)
|
||||
}
|
||||
p.User.AdditionalGids = append(p.User.AdditionalGids, uint32(gid))
|
||||
}
|
||||
return p, nil
|
||||
|
||||
@@ -114,6 +114,8 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "runc exec --additional-gids" {
|
||||
requires root
|
||||
|
||||
# run busybox detached
|
||||
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
Reference in New Issue
Block a user