From d999ada22c6261210c5da8aaf9dc4e08a3cb3385 Mon Sep 17 00:00:00 2001 From: Pavel Avgustinov Date: Tue, 14 Aug 2018 17:16:15 -0700 Subject: [PATCH] FunctionsWithWrappers: Simplify/tidy library. --- .../code/cpp/security/FunctionWithWrappers.qll | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/security/FunctionWithWrappers.qll b/cpp/ql/src/semmle/code/cpp/security/FunctionWithWrappers.qll index b541658a2b4..ee50cfbc61e 100644 --- a/cpp/ql/src/semmle/code/cpp/security/FunctionWithWrappers.qll +++ b/cpp/ql/src/semmle/code/cpp/security/FunctionWithWrappers.qll @@ -139,10 +139,14 @@ abstract class FunctionWithWrappers extends Function { */ predicate outermostWrapperFunctionCall(Expr arg, string callChain) { - exists(Function func, Call call, int argIndex | - func = resolveCall(call) - and this.wrapperFunction(func, argIndex, callChain) - and not wrapperFunctionStep(call.getEnclosingFunction(), _, func, argIndex) + exists(Function targetFunc, Call call, int argIndex | + targetFunc = resolveCall(call) + and this.wrapperFunction(targetFunc, argIndex, callChain) + and ( + exists(Function sourceFunc | sourceFunc = call.getEnclosingFunction() | + not wrapperFunctionStep(sourceFunc, _, targetFunc, argIndex) + ) or not exists(call.getEnclosingFunction()) + ) and arg = call.getArgument(argIndex) ) }