From f4713a70eb5dac047441bf3fc62fdc4b504a18b6 Mon Sep 17 00:00:00 2001 From: k1low Date: Wed, 2 Oct 2024 14:14:52 +0900 Subject: [PATCH] Fix nil pointer dereference in ctrl.DisabledReason --- sechub/sechub.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sechub/sechub.go b/sechub/sechub.go index c09049f..45dbdba 100644 --- a/sechub/sechub.go +++ b/sechub/sechub.go @@ -381,7 +381,11 @@ func ctrls(ctx context.Context, c *securityhub.Client, subscriptionArn *string) case types.ControlStatusEnabled: cs.Enable = append(cs.Enable, *ctrl.ControlId) case types.ControlStatusDisabled: - cs.Disable = append(cs.Disable, yaml.MapItem{Key: *ctrl.ControlId, Value: *ctrl.DisabledReason}) + reason := "No reason" + if ctrl.DisabledReason != nil { + reason = *ctrl.DisabledReason + } + cs.Disable = append(cs.Disable, yaml.MapItem{Key: *ctrl.ControlId, Value: reason}) } } nt = ctrls.NextToken