Function Call With Incorrect Order of Arguments
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.
The following examples help to illustrate the nature of this weakness and describe methods or techniques which can be used to mitigate the risk.
Note that the examples here are by no means exhaustive and any given weakness may have many subtle varieties, each of which may require different detection methods or runtime controls.
The following PHP method authenticates a user given a username/password combination but is called with the parameters in reverse order.
Weaknesses in this category are related to poor coding practices.
This category identifies Software Fault Patterns (SFPs) within the Glitch in Computation cluster (SFP1).
This view (slice) covers all the elements in CWE.
This view (slice) lists weaknesses that can be introduced during implementation.