Skip to content

Commit c24651c

Browse files
authored
Merge pull request #2728 from alexet/remove-recursion
CPP: Avoid uncessary recursion in printf.qll
2 parents 72fddaf + cd68836 commit c24651c

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

cpp/ql/src/semmle/code/cpp/commons/Printf.qll

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,7 @@ class FormatLiteral extends Literal {
258258
* Gets the position in the string at which the nth conversion specifier
259259
* starts.
260260
*/
261-
int getConvSpecOffset(int n) {
262-
n = 0 and result = this.getFormat().indexOf("%", 0, 0)
263-
or
264-
n > 0 and
265-
exists(int p |
266-
n = p + 1 and result = this.getFormat().indexOf("%", 0, this.getConvSpecOffset(p) + 2)
267-
)
268-
}
261+
int getConvSpecOffset(int n) { result = this.getFormat().indexOf("%", n, 0) }
269262

270263
/*
271264
* Each of these predicates gets a regular expressions to match each individual

0 commit comments

Comments
 (0)