File tree Expand file tree Collapse file tree
cpp/ql/test/query-tests/Likely Bugs/Likely Typos/UsingStrcpyAsBoolean Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424| test.cpp:127:9:127:37 | ! ... | Return value of strncpy used in a logical operation. |
2525| test.cpp:131:14:131:20 | call to strncpy | Return value of strncpy used as Boolean. |
2626| test.cpp:133:19:133:47 | ! ... | Return value of strncpy used in a logical operation. |
27+ | test.cpp:134:14:134:19 | call to strcpy | Return value of strcpy used as Boolean. |
2728| test.cpp:135:14:135:40 | ... && ... | Return value of strcpy used in a logical operation. |
2829| test.cpp:137:14:137:40 | ... == ... | Return value of strcpy used in a logical operation. |
2930| test.cpp:139:14:139:40 | ... != ... | Return value of strcpy used in a logical operation. |
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ void PositiveCases()
5656 }
5757
5858 result = !strncpy (szbuf1 , "test" , 100 ); // Bug
59-
59+ result = strcpy ( szbuf1 , "test" ) ? 1 : 0 ; // Bug [NOT DETECTED]
6060 result = strcpy (szbuf1 , "test" ) && 1 ; // Bug
6161
6262 result = strcpy (szbuf1 , "test" ) == 0 ; // Bug
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ void PositiveCases()
131131 bool b = strncpy (szbuf1, " test" , 100 ); // Bug
132132
133133 bool result = !strncpy (szbuf1, " test" , 100 ); // Bug
134-
134+ result = strcpy (szbuf1, " test " ) ? 1 : 0 ; // Bug
135135 result = strcpy (szbuf1, " test" ) && 1 ; // Bug
136136
137137 result = strcpy (szbuf1, " test" ) == 0 ; // Bug
You can’t perform that action at this time.
0 commit comments