Skip to content

Commit 54b8f8e

Browse files
committed
C++: Make getSecureAlgorithmRegex() return a single regexp as expected, and as getInsecureAlgorithmRegex() does.
1 parent 286c091 commit 54b8f8e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

cpp/ql/src/semmle/code/cpp/security/Encryption.qll

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,16 @@ string getASecureAlgorithmName() {
5959
* contain an algorithm that is known to be secure.
6060
*/
6161
string getSecureAlgorithmRegex() {
62-
// algorithms usually appear in names surrounded by characters that are not
63-
// alphabetical characters in the same case. This handles the upper and lower
64-
// case cases
65-
result = "(^|.*[^A-Z])" + getASecureAlgorithmName() + "([^A-Z].*|$)"
66-
or
67-
// for lowercase, we want to be careful to avoid being confused by camelCase
68-
// hence we require two preceding uppercase letters to be sure of a case
69-
// switch, or a preceding non-alphabetic character
70-
result = "(^|.*[A-Z]{2}|.*[^a-zA-Z])" + getASecureAlgorithmName().toLowerCase() + "([^a-z].*|$)"
62+
result =
63+
// algorithms usually appear in names surrounded by characters that are not
64+
// alphabetical characters in the same case. This handles the upper and lower
65+
// case cases
66+
"(^|.*[^A-Z])(" + strictconcat(getASecureAlgorithmName(), "|") + ")([^A-Z].*|$)" + "|" +
67+
// for lowercase, we want to be careful to avoid being confused by camelCase
68+
// hence we require two preceding uppercase letters to be sure of a case
69+
// switch, or a preceding non-alphabetic character
70+
"(^|.*[A-Z]{2}|.*[^a-zA-Z])(" + strictconcat(getASecureAlgorithmName().toLowerCase(), "|") +
71+
")([^a-z].*|$)"
7172
}
7273

7374
/**

0 commit comments

Comments
 (0)