Merge pull request #1185 from ulyssessouza/fix-array-out-of-bounds

Add defensive code
This commit is contained in:
Guillaume Tardif 2021-01-29 11:17:59 +01:00 committed by GitHub
commit 1693fbdf34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -315,6 +315,9 @@ func getVolumesFrom(project *types.Project, volumesFrom []string) ([]string, []s
}
for _, vol := range volumesFrom {
spec := strings.Split(vol, ":")
if len(spec) == 0 {
continue
}
if spec[0] == "container" {
volumes = append(volumes, strings.Join(spec[1:], ":"))
continue