Potential nil dereference
Description
The code may dereference a nil pointer, potentially causing a runtime error. This can occur when a function call is made on an object that has not been checked for nil.
Examples
Insecure Code
go
foo.bar()
if foo != nil {
// code
}Secure Code
go
if foo != nil {
foo.bar()
// code
}Remediation
Check for nil before calling methods on an object
Rule Details
| Field | Value |
|---|---|
| ID | CODE-0465 |
| Category | Generic |
| Severity | MEDIUM |
| CWE | CWE-253 |
| Confidence | MEDIUM |
| Impact | MEDIUM |
| Likelihood | MEDIUM |
| Exploitability | EASY |
| Tags | nil dereference |
| OWASP | N/A |