Files
codeql/csharp/ql/src/CSI/NullMaybe.ql
2025-10-03 15:29:34 +02:00

22 lines
654 B
Plaintext

/**
* @name Dereferenced variable may be null
* @description Dereferencing a variable whose value may be 'null' may cause a
* 'NullReferenceException'.
* @kind problem
* @problem.severity warning
* @precision high
* @id cs/dereferenced-value-may-be-null
* @tags quality
* reliability
* correctness
* exceptions
* external/cwe/cwe-476
*/
import csharp
import semmle.code.csharp.dataflow.Nullness
from Dereference d, Ssa::SourceVariable v, string msg, Element reason
where maybeNullDeref(d, v, msg, reason)
select d, "Variable $@ may be null at this access " + msg + ".", v, v.toString(), reason, "this"