From 3d70b60adc1783fb648f7d76ec6f9613f3c7c0ee Mon Sep 17 00:00:00 2001 From: Peter Hunt Date: Fri, 30 Oct 2020 10:45:08 -0400 Subject: spec: protect against segfault when the user passes in "/dev/null::w" Signed-off-by: Peter Hunt --- pkg/spec/parse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg/spec') 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] -- cgit v1.2.3-54-g00ecf