Skip to content

Commit 3641cdc

Browse files
committed
C++: Add a test case involving an array.
1 parent 23db21c commit 3641cdc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

cpp/ql/test/query-tests/Security/CWE/CWE-327/BrokenCryptoAlgorithm.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
| test2.cpp:49:4:49:24 | call to my_des_implementation | This file makes use of a broken or weak cryptographic algorithm (specified by $@). | test2.cpp:49:4:49:24 | call to my_des_implementation | call to my_des_implementation |
22
| test2.cpp:49:4:49:24 | call to my_des_implementation | This file makes use of a broken or weak cryptographic algorithm (specified by $@). | test2.cpp:64:33:64:40 | ALGO_DES | invocation of macro ALGO_DES |
3+
| test2.cpp:49:4:49:24 | call to my_des_implementation | This file makes use of a broken or weak cryptographic algorithm (specified by $@). | test2.cpp:66:31:66:38 | ALGO_DES | invocation of macro ALGO_DES |
34
| test2.cpp:49:4:49:24 | call to my_des_implementation | This file makes use of a broken or weak cryptographic algorithm (specified by $@). | test2.cpp:128:4:128:24 | call to my_des_implementation | call to my_des_implementation |
45
| test2.cpp:49:4:49:24 | call to my_des_implementation | This file makes use of a broken or weak cryptographic algorithm (specified by $@). | test2.cpp:148:27:148:29 | DES | access of enum constant DES |
56
| test2.cpp:49:4:49:24 | call to my_des_implementation | This file makes use of a broken or weak cryptographic algorithm (specified by $@). | test2.cpp:176:28:176:35 | ALGO_DES | invocation of macro ALGO_DES |

cpp/ql/test/query-tests/Security/CWE/CWE-327/test2.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ void encrypt_bad(char *data, size_t amount, keytype key, int algo)
5858

5959
void do_encrypts(char *data, size_t amount, keytype key)
6060
{
61-
61+
char data2[128];
6262

6363
encrypt_good(data, amount, key, ALGO_AES); // GOOD
6464
encrypt_bad(data, amount, key, ALGO_DES); // BAD
65-
66-
65+
encrypt_good(data2, 128, key, ALGO_AES); // GOOD
66+
encrypt_bad(data2, 128, key, ALGO_DES); // BAD
6767
}
6868

6969
// --- more involved CPP-style example ---

0 commit comments

Comments
 (0)