CWE-685: Function Call With Incorrect Number of Arguments

Variant Draft Simple

CWE版本: 4.18

更新日期: 2025-09-09

弱点描述

The product calls a function, procedure, or routine, but the caller specifies too many arguments, or too few arguments, which may lead to undefined behavior and resultant weaknesses.

常见后果

影响范围: Other

技术影响: Quality Degradation

潜在缓解措施

阶段: Testing

描述: Because this function call often produces incorrect behavior it will usually be detected during testing or normal operation of the product. 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.

检测方法

方法: Other

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 of arguments, such as format strings in C. It also can occur in languages or environments that do not require that functions always be called with the correct number of arguments, such as Perl.

引入模式

阶段 说明
Implementation This problem typically occurs when the programmer makes a typo, or copy and paste errors.

适用平台

编程语言
C (Undetermined) Perl (Undetermined)

分类映射

分类名称 条目ID 条目名称 映射适配度
Software Fault Patterns SFP1 Glitch in computation -
CERT C Secure Coding EXP37-C Call functions with the correct number and type of arguments CWE More Specific
CERT C Secure Coding FIO47-C Use valid format strings Imprecise
关键信息

CWE ID: CWE-685

抽象级别: Variant

结构: Simple

状态: Draft

相关弱点