mirror of
https://github.com/github/codeql.git
synced 2025-12-22 11:46:32 +01:00
CPP: Fix sscanf false positives in older linux repos
This commit is contained in:
@@ -19,4 +19,4 @@ import ScanfChecks
|
||||
|
||||
from ScanfFunctionCall call
|
||||
where incorrectlyCheckedScanf(call)
|
||||
select call, "The result of scanf is onyl checkeck against 0, but it can also return EOF."
|
||||
select call, "The result of scanf is only checked against 0, but it can also return EOF."
|
||||
|
||||
@@ -22,7 +22,8 @@ private predicate exprInBooleanContext(Expr e) {
|
||||
}
|
||||
|
||||
private predicate isLinuxKernel() {
|
||||
exists(Macro macro | macro.getName() = "_LINUX_KERNEL_SPRINTF_H_")
|
||||
// For the purpose of sscanf, we check the header guards for the files that it is defined in (which have changed)
|
||||
exists(Macro macro | macro.getName() in ["_LINUX_KERNEL_SPRINTF_H_", "_LINUX_KERNEL_H"])
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
| test.cpp:162:7:162:11 | call to scanf | The result of scanf is onyl checkeck against 0, but it can also return EOF. |
|
||||
| test.cpp:171:7:171:11 | call to scanf | The result of scanf is onyl checkeck against 0, but it can also return EOF. |
|
||||
| test.cpp:204:7:204:11 | call to scanf | The result of scanf is onyl checkeck against 0, but it can also return EOF. |
|
||||
| test.cpp:436:7:436:11 | call to scanf | The result of scanf is onyl checkeck against 0, but it can also return EOF. |
|
||||
| test.cpp:443:11:443:15 | call to scanf | The result of scanf is onyl checkeck against 0, but it can also return EOF. |
|
||||
| test.cpp:162:7:162:11 | call to scanf | The result of scanf is only checked against 0, but it can also return EOF. |
|
||||
| test.cpp:171:7:171:11 | call to scanf | The result of scanf is only checked against 0, but it can also return EOF. |
|
||||
| test.cpp:204:7:204:11 | call to scanf | The result of scanf is only checked against 0, but it can also return EOF. |
|
||||
| test.cpp:436:7:436:11 | call to scanf | The result of scanf is only checked against 0, but it can also return EOF. |
|
||||
| test.cpp:443:11:443:15 | call to scanf | The result of scanf is only checked against 0, but it can also return EOF. |
|
||||
|
||||
Reference in New Issue
Block a user