C++: Fix qhelp for double-free.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-04-13 10:10:42 +01:00
parent ba4e3ae949
commit e0aeea058e

View File

@@ -6,19 +6,17 @@
<overview>
<p>
Dereferencing a pointer after it has been deallocated may result in memory corruption which can
lead to security vulnerabilities.
Deallocating memory more than once can lead to a double-free vulnerability. This can be exploited to
corrupt the allocator's internal data structures, which can lead to denial-of-service attacks by crashing
the program, or to security vulnerabilities by allowing an attacker to overwrite arbitrary memory locations.
</p>
<include src="dataFlowWarning.inc.qhelp" />
</overview>
<recommendation>
<p>
Ensure that all execution paths deallocate the allocated memory at most once. If possible, reassign
the pointer to a null value after deallocating it. This will both prevent double-free vulnerabilities, and
increase the likelihood of the operating system raising a runtime error if the pointer is subsequently
dereferenced after being deallocated.
the pointer to a null value after deallocating it. This will prevent double-free vulnerabilities since
most deallocation functions will perform a null-pointer check before attempting to deallocate the memory.
</p>
</recommendation>