COMMON WEAKNESS ENUMERATIONDraft

CWE-683

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.

Abstraction

Variant

Structure

Simple

Likelihood of Exploit

Medium

Understand the problem

What is the problem?

The product calls a function, procedure, or routine, but the caller specifies the arguments in an incorrect order, leading to resultant weaknesses.

Extended description

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.

Root cause

How and when does the problem arise?

Lifecycle phase

Implementation

This problem typically occurs when the programmer makes a typo, or copy and paste errors.

Risk

What does successful exploitation lead to?

Quality Degradation

Affected security scopes: Other

Defence

How is it prevented and fixed?

Implementation

Implementation-phase defence

Detail
Use the function, procedure, or routine as specified.

Verification

How is it detected?

Automated Analysis

Because this function call often produces incorrect behavior, it will usually be detected during testing or normal operation of the product.

Automated Analysis

Exercising all possible control paths will typically expose this weakness, except in rare cases when the incorrect function call accidentally produces the correct results, or if the provided argument type is very similar to the expected argument type.