CVE-2025-25204: Go Nil Error Return On Empty Check
Returning an unassigned `err` variable inside an empty collection or nil check (`len(x) == 0` or `x == nil`) often results in inadvertently returning `nil` when a failure was intended. Ensure that you explicitly create and return a new error using `fmt.Errorf` or `errors.New` if this logic path represents a failure state.
Provally CuratedPublic repositoryMediumMedium confidenceVerifiedApache-2.0Goβ
greprules fetch cve-2025-25204-go-nil-error-return-on-empty-check --engine opengrepDescription
Returning an unassigned `err` variable inside an empty collection or nil check (`len(x) == 0` or `x == nil`) often results in inadvertently returning `nil` when a failure was intended. Ensure that you explicitly create and return a new error using `fmt.Errorf` or `errors.New` if this logic path represents a failure state.
Community feedback
0 signals from signed-in users.
- Useful
- 0
- False positive
- 0
- Metadata
- 0