parseIDMapping: accept 32-bit IDs

Signed-off-by: Sherif Mowafy <sherif.mowafy@gmail.com>
This commit is contained in:
Sherif 2020-07-18 13:32:32 +02:00
parent e818fe27ce
commit 96099550b5
No known key found for this signature in database
GPG Key ID: 0D27260550C09419

View File

@ -289,15 +289,15 @@ func parseIDMapping(mapping string) (specs.LinuxIDMapping, error) {
if len(parts) != 3 { if len(parts) != 3 {
return specs.LinuxIDMapping{}, errors.New("user namespace mappings require the format `container-id:host-id:size`") return specs.LinuxIDMapping{}, errors.New("user namespace mappings require the format `container-id:host-id:size`")
} }
cID, err := strconv.ParseUint(parts[0], 0, 16) cID, err := strconv.ParseUint(parts[0], 0, 32)
if err != nil { if err != nil {
return specs.LinuxIDMapping{}, errors.Wrapf(err, "invalid container id for user namespace remapping") return specs.LinuxIDMapping{}, errors.Wrapf(err, "invalid container id for user namespace remapping")
} }
hID, err := strconv.ParseUint(parts[1], 0, 16) hID, err := strconv.ParseUint(parts[1], 0, 32)
if err != nil { if err != nil {
return specs.LinuxIDMapping{}, errors.Wrapf(err, "invalid host id for user namespace remapping") return specs.LinuxIDMapping{}, errors.Wrapf(err, "invalid host id for user namespace remapping")
} }
size, err := strconv.ParseUint(parts[2], 0, 16) size, err := strconv.ParseUint(parts[2], 0, 32)
if err != nil { if err != nil {
return specs.LinuxIDMapping{}, errors.Wrapf(err, "invalid size for user namespace remapping") return specs.LinuxIDMapping{}, errors.Wrapf(err, "invalid size for user namespace remapping")
} }