mirror of https://github.com/containers/podman.git
Kube Generate - check options in bind-mount-options exist before accessing
Verify that the separator ':' was found before splitting the string [NO NEW TESTS NEEDED] Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
This commit is contained in:
parent
7dc7cbfd9b
commit
4083ddbb00
|
@ -488,7 +488,7 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
|
||||||
// Make sure the z/Z option is not already there (from editing the YAML)
|
// Make sure the z/Z option is not already there (from editing the YAML)
|
||||||
if k == define.BindMountPrefix {
|
if k == define.BindMountPrefix {
|
||||||
lastIndex := strings.LastIndex(v, ":")
|
lastIndex := strings.LastIndex(v, ":")
|
||||||
if v[:lastIndex] == volumeSource.Source && !cutil.StringInSlice("z", options) && !cutil.StringInSlice("Z", options) {
|
if lastIndex != -1 && v[:lastIndex] == volumeSource.Source && !cutil.StringInSlice("z", options) && !cutil.StringInSlice("Z", options) {
|
||||||
options = append(options, v[lastIndex+1:])
|
options = append(options, v[lastIndex+1:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue