spec: protect against segfault

when the user passes in "/dev/null::w"

Signed-off-by: Peter Hunt <pehunt@redhat.com>
This commit is contained in:
Peter Hunt
2020-10-30 10:45:08 -04:00
parent 228396a99d
commit 3d70b60adc

View File

@ -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]