diff --git a/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToMemset.ql b/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToMemset.ql index 6e9b11cf37f1..bcbec1bd961d 100644 --- a/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToMemset.ql +++ b/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToMemset.ql @@ -52,13 +52,13 @@ Type stripType(Type t) { /** * Holds if `t` points to `base` via a specified number of levels of pointer - * indirection. Intermediate typedefs and array types are allowed. + * indirection. Intermediate typedefs and array types are allowed. Note that + * `base` is a stripped type (via `stripType`). */ predicate pointerIndirection(Type t, int indirection, Type base) { - exists(Type u | - u = stripType(t) and - u = stripType(base) and - not u instanceof PointerType and + ( + base = stripType(t) and + not base instanceof PointerType and indirection = 0 ) or ( pointerIndirection(stripType(t).(PointerType).getBaseType(), indirection - 1, base)