diff options
author | Peter Hunt <pehunt@redhat.com> | 2020-10-30 10:45:08 -0400 |
---|---|---|
committer | Peter Hunt <pehunt@redhat.com> | 2020-10-30 10:45:10 -0400 |
commit | 3d70b60adc1783fb648f7d76ec6f9613f3c7c0ee (patch) | |
tree | d6f6d88b9ac5363004c0f2f66456009012cb9902 /pkg/spec | |
parent | 228396a99dc88fc828f23d4072a46ca8de90282f (diff) | |
download | podman-3d70b60adc1783fb648f7d76ec6f9613f3c7c0ee.tar.gz podman-3d70b60adc1783fb648f7d76ec6f9613f3c7c0ee.tar.bz2 podman-3d70b60adc1783fb648f7d76ec6f9613f3c7c0ee.zip |
spec: protect against segfault
when the user passes in "/dev/null::w"
Signed-off-by: Peter Hunt <pehunt@redhat.com>
Diffstat (limited to 'pkg/spec')
-rw-r--r-- | pkg/spec/parse.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/spec/parse.go b/pkg/spec/parse.go index 38d93b87f..9ebcf8d29 100644 --- a/pkg/spec/parse.go +++ b/pkg/spec/parse.go @@ -173,7 +173,7 @@ func ParseDevice(device string) (string, string, string, error) { //nolint if IsValidDeviceMode(arr[1]) { permissions = arr[1] } else { - if arr[1][0] != '/' { + if len(arr[1]) == 0 || arr[1][0] != '/' { return "", "", "", fmt.Errorf("invalid device mode: %s", arr[1]) } dst = arr[1] |