Python: Use explicit argument specification instead of getAnArg

I've seen quite a few places where `getAnArg` leads to wrong behavior, and I
generally just don't like it.
This commit is contained in:
Rasmus Wriedt Larsen
2021-02-24 10:19:34 +01:00
parent c3d2001e85
commit 5bb4a1a45a

View File

@@ -24,8 +24,9 @@ private API::Node paramikoSSHClientInstance() {
from DataFlow::CallCfgNode call, DataFlow::Node arg, string name
where
// see http://docs.paramiko.org/en/stable/api/client.html#paramiko.client.SSHClient.set_missing_host_key_policy
call = paramikoSSHClientInstance().getMember("set_missing_host_key_policy").getACall() and
arg = call.getAnArg() and
arg in [call.getArg(0), call.getArgByName("policy")] and
(
arg = unsafe_paramiko_policy(name).getAUse() or
arg = unsafe_paramiko_policy(name).getReturn().getAUse()