Merge pull request #8329 from hashicorp/fix_8325

builder/virtualbox/common/snapshot.go: avoid a panic on a too short slice.
This commit is contained in:
Megan Marsh 2019-11-05 09:14:22 -08:00 committed by GitHub
commit d7b2aa88c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -35,7 +35,7 @@ func ParseSnapshotData(snapshotData string) (*VBoxSnapshot, error) {
node.IsCurrent = true node.IsCurrent = true
} else { } else {
matches := SnapshotNamePartsRe.FindStringSubmatch(txt) matches := SnapshotNamePartsRe.FindStringSubmatch(txt)
if matches[1] == "Name" { if len(matches) >= 2 && matches[1] == "Name" {
if nil == rootNode { if nil == rootNode {
node = new(VBoxSnapshot) node = new(VBoxSnapshot)
rootNode = node rootNode = node