Skip to content

Commit

Permalink
Fix SEGV
Browse files Browse the repository at this point in the history
Signed-off-by: Daichi Sakaue <[email protected]>
  • Loading branch information
yokaze committed Dec 11, 2024
1 parent c8101ce commit b041c09
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/npv/app/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package app

import (
"context"
"errors"
"fmt"
"io"
"sort"
Expand Down Expand Up @@ -102,6 +103,15 @@ func runList(ctx context.Context, w io.Writer, name string) error {
if err != nil {
return fmt.Errorf("failed to get endpoint information: %w", err)
}
if response.Payload == nil ||
response.Payload.Status == nil ||
response.Payload.Status.Policy == nil ||
response.Payload.Status.Policy.Realized == nil ||
response.Payload.Status.Policy.Realized.L4 == nil ||
response.Payload.Status.Policy.Realized.L4.Ingress == nil ||
response.Payload.Status.Policy.Realized.L4.Egress == nil {
return errors.New("api response is insufficient")
}

// The same rule appears multiple times in the response, so we need to dedup it
policySet := make(map[derivedFromEntry]struct{})
Expand Down

0 comments on commit b041c09

Please sign in to comment.