Skip to content

Commit 880306c

Browse files
Removing duplicated results
1 parent 89c045b commit 880306c

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ predicate isStringCopyUsedInCondition( FunctionCall func, Expr expr1, string msg
6767

6868
from FunctionCall func, Expr expr1, string msg
6969
where
70-
isStringCopyCastedAsBoolean(func, expr1, msg)
70+
( isStringCopyCastedAsBoolean(func, expr1, msg) and
71+
not isStringCopyUsedInCondition(func, expr1, _)
72+
)
7173
or isStringCopyUsedInCondition(func, expr1, msg)
7274
select expr1, msg

cpp/ql/test/query-tests/Likely Bugs/Likely Typos/UsingStrcpyAsBoolean/UsingStrcpyAsBoolean.expected

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,20 @@
44
| test.c:45:9:45:48 | ... && ... | Return Value of strcpy used in a conditional. |
55
| test.c:49:9:49:15 | call to strncpy | Return Value of strncpy used in a conditional. |
66
| test.c:53:6:53:34 | ! ... | Return Value of strncpy used in a conditional. |
7-
| test.cpp:75:9:75:14 | call to strcpy | Return Value of strcpy used as boolean. |
87
| test.cpp:75:9:75:14 | call to strcpy | Return Value of strcpy used in a conditional. |
98
| test.cpp:79:9:79:31 | ! ... | Return Value of strcpy used in a conditional. |
109
| test.cpp:79:10:79:15 | call to strcpy | Return Value of strcpy used as boolean. |
1110
| test.cpp:83:9:83:35 | ... == ... | Return Value of strcpy used in a conditional. |
1211
| test.cpp:87:9:87:48 | ... && ... | Return Value of strcpy used in a conditional. |
1312
| test.cpp:87:27:87:32 | call to strcpy | Return Value of strcpy used as boolean. |
14-
| test.cpp:91:9:91:37 | call to wcscpy | Return Value of wcscpy used as boolean. |
1513
| test.cpp:91:9:91:37 | call to wcscpy | Return Value of wcscpy used in a conditional. |
16-
| test.cpp:95:9:95:14 | call to wcscpy | Return Value of wcscpy used as boolean. |
1714
| test.cpp:95:9:95:14 | call to wcscpy | Return Value of wcscpy used in a conditional. |
18-
| test.cpp:99:9:99:15 | call to _mbscpy | Return Value of _mbscpy used as boolean. |
1915
| test.cpp:99:9:99:15 | call to _mbscpy | Return Value of _mbscpy used in a conditional. |
20-
| test.cpp:103:9:103:15 | call to strncpy | Return Value of strncpy used as boolean. |
2116
| test.cpp:103:9:103:15 | call to strncpy | Return Value of strncpy used in a conditional. |
22-
| test.cpp:107:9:107:15 | call to wcsncpy | Return Value of wcsncpy used as boolean. |
2317
| test.cpp:107:9:107:15 | call to wcsncpy | Return Value of wcsncpy used in a conditional. |
24-
| test.cpp:111:9:111:16 | call to _mbsncpy | Return Value of _mbsncpy used as boolean. |
2518
| test.cpp:111:9:111:16 | call to _mbsncpy | Return Value of _mbsncpy used in a conditional. |
26-
| test.cpp:115:9:115:18 | call to _strncpy_l | Return Value of _strncpy_l used as boolean. |
2719
| test.cpp:115:9:115:18 | call to _strncpy_l | Return Value of _strncpy_l used in a conditional. |
28-
| test.cpp:119:9:119:18 | call to _wcsncpy_l | Return Value of _wcsncpy_l used as boolean. |
2920
| test.cpp:119:9:119:18 | call to _wcsncpy_l | Return Value of _wcsncpy_l used in a conditional. |
30-
| test.cpp:123:9:123:18 | call to _mbsncpy_l | Return Value of _mbsncpy_l used as boolean. |
3121
| test.cpp:123:9:123:18 | call to _mbsncpy_l | Return Value of _mbsncpy_l used in a conditional. |
3222
| test.cpp:127:6:127:34 | ! ... | Return Value of strncpy used in a conditional. |
3323
| test.cpp:127:7:127:13 | call to strncpy | Return Value of strncpy used as boolean. |

0 commit comments

Comments
 (0)