mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
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:
@ -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)
|
||||
if k == define.BindMountPrefix {
|
||||
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:])
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user