Function Call With Incorrect Argument Type |
Weakness ID: 686 (Weakness Variant) | Status: Draft |
Description Summary
The software calls a function, procedure, or routine, but the caller specifies an argument that is the wrong data type, which may lead to resultant weaknesses.
Extended Description
This weakness is most likely to occur in loosely typed languages, or in strongly typed languages in which the types of variable arguments cannot be enforced at compilation time, or where there is implicit casting.
Use the function, procedure, routine as specified. |
Because this function call often produces incorrect behavior it will usually be detected during testing or normal operation of the software. During testing exercise 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. |
Ordinality | Description |
---|---|
Primary | (where the weakness exists independent of other weaknesses) |
Nature | Type | ID | Name | View(s) this relationship pertains to![]() |
---|---|---|---|---|
ChildOf | ![]() | 628 | Function Call with Incorrectly Specified Arguments | Development Concepts (primary)699 Research Concepts (primary)1000 |
ChildOf | ![]() | 736 | CERT C Secure Coding Section 02 - Declarations and Initialization (DCL) | Weaknesses Addressed by the CERT C Secure Coding Standard (primary)734 |
ChildOf | ![]() | 739 | CERT C Secure Coding Section 05 - Floating Point (FLP) | Weaknesses Addressed by the CERT C Secure Coding Standard734 |
ChildOf | ![]() | 741 | CERT C Secure Coding Section 07 - Characters and Strings (STR) | Weaknesses Addressed by the CERT C Secure Coding Standard734 |
ChildOf | ![]() | 743 | CERT C Secure Coding Section 09 - Input Output (FIO) | Weaknesses Addressed by the CERT C Secure Coding Standard734 |
ChildOf | ![]() | 748 | CERT C Secure Coding Section 50 - POSIX (POS) | Weaknesses Addressed by the CERT C Secure Coding Standard734 |
Mapped Taxonomy Name | Node ID | Fit | Mapped Node Name |
---|---|---|---|
CERT C Secure Coding | DCL35-C | Do not invoke a function using a type that does not match the function definition | |
CERT C Secure Coding | FIO00-C | Take care when creating format strings | |
CERT C Secure Coding | FLP31-C | Do not call functions expecting real values with complex values | |
CERT C Secure Coding | POS34-C | Do not call putenv() with a pointer to an automatic variable as the argument | |
CERT C Secure Coding | STR37-C | Arguments to character handling functions must be representable as an unsigned char |
Modifications | ||||
---|---|---|---|---|
Modification Date | Modifier | Organization | Source | |
2008-07-01 | Eric Dalci | Cigital | External | |
updated Potential Mitigations | ||||
2008-09-08 | CWE Content Team | MITRE | Internal | |
updated Description, Relationships, Other Notes, Weakness Ordinalities | ||||
2008-11-24 | CWE Content Team | MITRE | Internal | |
updated Relationships, Taxonomy Mappings | ||||
2009-05-27 | CWE Content Team | MITRE | Internal | |
updated Description | ||||
2009-10-29 | CWE Content Team | MITRE | Internal | |
updated Other Notes, Potential Mitigations |