Skip to content

Commit

Permalink
Merge pull request #904 from brandond/fix_null_output
Browse files Browse the repository at this point in the history
Fix successfully unmarshalled nil raw result
  • Loading branch information
dcbw authored Jul 27, 2022
2 parents 812a8cf + 1c7c696 commit 3363d14
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/invoke/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ func fixupResultVersion(netconf, result []byte) (string, []byte, error) {
return "", nil, fmt.Errorf("failed to unmarshal raw result: %w", err)
}

// plugin output of "null" is successfully unmarshalled, but results in a nil
// map which causes a panic when the confVersion is assigned below.
if rawResult == nil {
rawResult = make(map[string]interface{})
}

// Manually decode Result version; we need to know whether its cniVersion
// is empty, while built-in decoders (correctly) substitute 0.1.0 for an
// empty version per the CNI spec.
Expand Down

0 comments on commit 3363d14

Please sign in to comment.