CWE-683ΒΆ

Function Call With Incorrect Order of Arguments. [Improper-Adherence-To-Coding-Standards]

Required inputs: IR

The product calls a function, procedure, or routine, but the caller specifies the arguments in an incorrect order, leading to resultant weaknesses. While this weakness might be caught by the compiler in some languages, it can occur more frequently in cases in which the called function accepts variable numbers or types of arguments, such as format strings in C. It also can occur in languages or environments that do not enforce strong typing.
Demonstrative Examples
Example 1

The following PHP method authenticates a user given a username/password combination but is called with the parameters in reverse order.

Example Language:PHP (Unsupported language for documentation only)
    function authenticate($username, $password) {
        // authenticate user
        ...
    }

    authenticate($_POST['password'], $_POST['username']);
Excerpts from CWE [https://cwe.mitre.org], Copyright (C) 2006-2026, the MITRE Corporation. See section 9.4. "3rd-Party Licenses" in the documentation for full details.

Possible Messages

Key

Text

Severity

Disabled

possible_argument_order_mixed_up

Name of call argument {} at position {} equals name of parameter at position {}.

None

False

Options