CWE-762:不匹配的内存管理例程
View customized information:
The product attempts to return a memory resource to the system, but it calls a release function that is not compatible with the function that was originally used to allocate that resource.
This weakness can be generally described as mismatching memory management routines, such as:
When the memory management functions are mismatched, the consequences may be as severe as code execution, memory corruption, or program crash. Consequences and ease of exploit will vary depending on the implementation of the routines and the object being managed.
该表显示了与该弱点相关的弱点和高级类别。这些关系定义为childof,parentof,ementof,并深入了解可能存在于较高和较低抽象水平的类似项目。此外,定义了诸如Peerof和Canalsobe之类的关系,以显示用户可能想要探索的类似弱点。
Relevant to the view "Research Concepts" (CWE-1000)
与“ CISQ数据保护措施”(CWE-1340)有关
引言的不同模式提供了有关如何以及何时引入这种弱点的信息。该阶段识别可能发生介绍的生命周期中的一个点,而音符提供了与给定阶段中引言有关的典型情况。
该清单显示了可能出现的弱点的可能区域。这些可能适用于特定的命名语言,操作系统,体系结构,范式,技术或一类此类平台。该平台与给定弱点出现在该实例的频率一起列出。
语言 C(不确定的患病率) C ++(不确定的患病率)
该表指定与弱点相关的不同个人后果。该范围确定了违反的应用程序安全区域,而影响描述了如果对手成功利用这一弱点,就会产生负面的技术影响。其可能性提供了有关预期相对于列表中其他后果的特定后果的可能性的信息。例如,可能会利用弱点来实现一定的影响,但很可能会利用它来实现不同的影响。
Example 1 此示例使用C ++中的新运算符分配Barobj对象,但是,程序员然后使用Free()对对象进行处理,这可能导致意外行为。
(不良代码)
Example Language:C ++
void foo(){
barobj *ptr = new barobj()
/* do some work with ptr here */ ... 免费(ptr); Instead, the programmer should have either created the object with one of the malloc family functions, or else deleted the object with the delete operator.
(good code)
Example Language:C ++
void foo(){
barobj *ptr = new barobj()
/* do some work with ptr here */ ... delete ptr; Example 2 In this example, the program does not use matching functions such as malloc/free, new/delete, and new[]/delete[] to allocate/deallocate the resource.
(不良代码)
Example Language:C ++
A类{
void foo(); };void a :: foo(){
int *ptr; }ptr =(int*)malloc(sizeof(int)); delete ptr; Example 3 在此示例中,该程序在非HEAP内存上调用delete []函数。
(不良代码)
Example Language:C ++
class A{
void foo(bool); };void A::foo(bool heap) {
int localArray[2] = { }
11,22 };int *p = localArray; 如果(堆){
p = new int [2]; }删除[] p;
This MemberOf Relationships table shows additional CWE Categories and Views that reference this weakness as a member. This information is often useful in understanding where a weakness fits within the context of external information sources.
Applicable Platform This weakness is possible in any programming language that allows manual management of memory.
More information is available — Please select a different filter.
|
Use of the Common Weakness Enumeration (CWE) and the associated references from this website are subject to the使用条款. CWE is sponsored by theU.S. Department of Homeland Security(DHS)网络安全和基础设施安全局(CISA),由国土安全系统工程和开发研究所(HSSEDI) which is operated bymanbetx客户端首页(MITRE). Copyright © 2006–2023, The MITRE Corporation. CWE, CWSS, CWRAF, and the CWE logo are trademarks of The MITRE Corporation. |