Use matches to check for 0x prefix

This commit is contained in:
Jeroen Ketema
2022-02-02 15:26:46 +01:00
parent 92d9e51d2a
commit 0773ab37a5

View File

@@ -3,7 +3,7 @@ import semmle.code.cpp.commons.unix.Constants
bindingset[input]
int parseHex(string input) {
input.prefix(2) = "0x" and
input.matches("0x%") and
result =
strictsum(int ix |
ix in [2 .. input.length()]