Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap nil PerformanceData check for length check #104

Closed
atc0005 opened this issue Nov 26, 2021 · 0 comments · Fixed by #105
Closed

Swap nil PerformanceData check for length check #104

atc0005 opened this issue Nov 26, 2021 · 0 comments · Fixed by #105
Assignees
Labels
bug Something isn't working performance data
Milestone

Comments

@atc0005
Copy link
Owner

atc0005 commented Nov 26, 2021

Current check:

go-nagios/nagios.go

Lines 385 to 389 in b399b44

func (es *ExitState) AddPerfData(skipValidate bool, pd ...PerformanceData) error {
if pd == nil {
return fmt.Errorf("no performance data provided")
}

Use length check instead of nil slice check. I don't know whether it's legitimate to pass in an initialized but empty slice, but a length check would catch that scenario in addition to an actual nil slice.

@atc0005 atc0005 added bug Something isn't working performance data labels Nov 26, 2021
@atc0005 atc0005 added this to the Next Release milestone Nov 26, 2021
@atc0005 atc0005 self-assigned this Nov 26, 2021
atc0005 added a commit that referenced this issue Nov 29, 2021
This change accounts for the potential to receive an empty
slice in addition to a nil slice (as we were checking for
prior to this change).

refs GH-104
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working performance data
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant