mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
QL code and tests for C#/C++/JavaScript.
This commit is contained in:
15
cpp/ql/src/Critical/MissingNullTest.ql
Normal file
15
cpp/ql/src/Critical/MissingNullTest.ql
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @name Returned pointer not checked
|
||||
* @description A value returned from a function that may return null is not tested to determine whether or not it is null. Dereferencing NULL pointers lead to undefined behavior.
|
||||
* @kind problem
|
||||
* @id cpp/missing-null-test
|
||||
* @problem.severity recommendation
|
||||
* @tags reliability
|
||||
* external/cwe/cwe-476
|
||||
*/
|
||||
import cpp
|
||||
|
||||
from VariableAccess access
|
||||
where maybeNull(access)
|
||||
and dereferenced(access)
|
||||
select access, "Value may be null; it should be checked before dereferencing."
|
||||
Reference in New Issue
Block a user