Files
codeql/csharp/ql/src/CSI/NullAlways.ql
2022-09-26 14:01:39 +02:00

20 lines
564 B
Plaintext

/**
* @name Dereferenced variable is always null
* @description Dereferencing a variable whose value is 'null' causes a 'NullReferenceException'.
* @kind problem
* @problem.severity error
* @precision very-high
* @id cs/dereferenced-value-is-always-null
* @tags reliability
* correctness
* exceptions
* external/cwe/cwe-476
*/
import csharp
import semmle.code.csharp.dataflow.Nullness
from Dereference d, Ssa::SourceVariable v
where d.isFirstAlwaysNull(v)
select d, "Variable $@ is always null at this dereference.", v, v.toString()