Merge pull request #8200 from haircommander/parse-segfault

spec: protect against segfault
This commit is contained in:
OpenShift Merge Robot 2020-10-30 19:42:26 +01:00 committed by GitHub
commit 3653e57a2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

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]