summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-30 19:42:26 +0100
committerGitHub <noreply@github.com>2020-10-30 19:42:26 +0100
commit3653e57a2a589bebfdde99fb3c0334d04f350888 (patch)
treedd28e8125f5c1ee569cbd0219c4bd9fbfcfc6759
parent37b550c96aeef9d6d248183bab328f6bfe5f4d5b (diff)
parent3d70b60adc1783fb648f7d76ec6f9613f3c7c0ee (diff)
downloadpodman-3653e57a2a589bebfdde99fb3c0334d04f350888.tar.gz
podman-3653e57a2a589bebfdde99fb3c0334d04f350888.tar.bz2
podman-3653e57a2a589bebfdde99fb3c0334d04f350888.zip
Merge pull request #8200 from haircommander/parse-segfault
spec: protect against segfault
-rw-r--r--pkg/spec/parse.go2
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]