mirror of
https://github.com/github/codeql.git
synced 2026-01-15 15:34:49 +01:00
22 lines
619 B
Plaintext
22 lines
619 B
Plaintext
/**
|
|
* @name Incorrect return-value check for a 'scanf'-like function
|
|
* @description Failing to account for EOF in a call to a scanf-like function can lead to
|
|
* undefined behavior.
|
|
* @kind problem
|
|
* @problem.severity warning
|
|
* @security-severity 7.5
|
|
* @precision high
|
|
* @id cpp/incorrectly-checked-scanf
|
|
* @tags security
|
|
* correctness
|
|
* external/cwe/cwe-253
|
|
*/
|
|
|
|
import cpp
|
|
import semmle.code.cpp.commons.Scanf
|
|
import ScanfChecks
|
|
|
|
from ScanfFunctionCall call
|
|
where incorrectlyCheckedScanf(call)
|
|
select call, "The result of scanf is only checked against 0, but it can also return EOF."
|