Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ca3554d

Browse files
committed
C++: Incorporate docs review comments
1 parent 7ff94e8 commit ca3554d

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

change-notes/1.20/analysis-cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
| **Query** | **Tags** | **Purpose** |
1010
|-----------------------------|-----------|--------------------------------------------------------------------|
11-
| Use of string copy function in a condition (`cpp/string-copy-return-value-as-boolean`) | correctness | This rule flags calls to string copy functions used in conditions, where it's likely that a different function was intended to be called. |
11+
| Use of string copy function in a condition (`cpp/string-copy-return-value-as-boolean`) | correctness | This query identifies calls to string copy functions used in conditions, where it's likely that a different function was intended to be called. |
1212

1313
## Changes to existing queries
1414

cpp/ql/src/Likely Bugs/Likely Typos/UsingStrcpyAsBoolean.qhelp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<qhelp>
55

66
<overview>
7-
<p>This rule flags calls to string copy functions used in conditions, either
7+
<p>This query identifies calls to string copy functions used in conditions, either
88
directly or as part of an equality operator or logical operator. The most
99
common string copy functions always return their <code>destination</code>
1010
parameter and do not have a return value reserved to indicate an error.
@@ -39,7 +39,7 @@ context.</p>
3939
<references>
4040
<li>Microsoft Code Analysis for C/C++: <a href="https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2012/ccf4h9w8(v=vs.110)">C6324</a></li>
4141
<li>Microsoft C library reference: <a href="https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcpy-wcscpy-mbscpy">strcpy, wcscpy, _mbscpy</a></li>
42-
<li>US-CERT: <a href="https://www.us-cert.gov/bsi/articles/knowledge/coding-practices/strcpy_s-and-strcat_s">strncpy_s() and strncat_s()</a></li>
42+
<li>US-CERT: <a href="https://www.us-cert.gov/bsi/articles/knowledge/coding-practices/strcpy_s-and-strcat_s">strcpy_s() and strcat_s()</a></li>
4343

4444
</references>
4545
</qhelp>

cpp/ql/src/Likely Bugs/Likely Typos/UsingStrcpyAsBoolean.ql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ predicate isStringCopyCastedAsBoolean(FunctionCall func, Expr expr1, string msg)
3737
DataFlow::localFlow(DataFlow::exprNode(func), DataFlow::exprNode(expr1)) and
3838
isBoolean(expr1.getConversion*()) and
3939
isStringComparisonFunction(func.getTarget().getName()) and
40-
msg = "Return value of " + func.getTarget().getName() + " used as Boolean."
40+
msg = "Return value of " + func.getTarget().getName() + " used as a Boolean."
4141
}
4242

4343
predicate isStringCopyUsedInLogicalOperationOrCondition(FunctionCall func, Expr expr1, string msg) {
@@ -60,8 +60,7 @@ predicate isStringCopyUsedInLogicalOperationOrCondition(FunctionCall func, Expr
6060
func = ble.getAnOperand()
6161
)
6262
) and
63-
msg = "Return value of " + func.getTarget().getName() +
64-
" used in a logical operation."
63+
msg = "Return value of " + func.getTarget().getName() + " used in a logical operation."
6564
or
6665
// or the string copy function is used directly as the conditional expression
6766
(

0 commit comments

Comments
 (0)