Skip to content

Commit 19ee64d

Browse files
committed
C++:Lower potentially-dangerous-function precision
There have been multiple reports of false positives from this query over time. Now that it has `@security-severity 10.0`, these false positives look even worse. The query looks purely for calls to functions with certain names, not at whether the calls happen in a dangerous context. To justify a higher precision, the query should only flag calls that happen in a thread or another non-reentrant context.
1 parent 2f5ed03 commit 19ee64d

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lgtm,codescanning
2+
* Lowered the precision of `cpp/potentially-dangerous-function` so it is run but not displayed on LGTM by default and so it's only run and displayed on Code Scanning if a broader suite like `cpp-security-extended` is opted into.

cpp/ql/src/Security/CWE/CWE-676/PotentiallyDangerousFunction.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ can use their own storage.</p>
2626
<p>Similarly replace calls to <code>localtime</code> with
2727
<code>localtime_r</code>, calls to <code>ctime</code> with
2828
<code>ctime_r</code> and calls to <code>asctime</code> with
29-
<code>asctime_r</code>.</p>
29+
<code>asctime_r</code> (if those functions exist on your platform).</p>
3030

3131
</recommendation>
3232
<example>

cpp/ql/src/Security/CWE/CWE-676/PotentiallyDangerousFunction.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @kind problem
55
* @problem.severity warning
66
* @security-severity 10.0
7-
* @precision high
7+
* @precision medium
88
* @id cpp/potentially-dangerous-function
99
* @tags reliability
1010
* security

0 commit comments

Comments
 (0)