...
Wiki Markup |
---|
Failing to follow this recommendation has led to real-world vulnerabilities. For example, freeing memory in different modules resulted in a vulnerability in MIT Kerberos 5 \[[MIT 04|AA. C References#MIT 04]\]. The MIT Kerberos 5 code in this case contained error-handling logic, which freed memory allocated by the ASN.1 decoders if pointers to the allocated memory were non-NULL. However, if a detectable error occuredoccurred, the ASN.1 decoders freed the memory that they had allocated. When some library functions received errors from the ASN.1 decoders, they also attempted to free, resulting in a double-free vulnerability. |
...
Compliant Solution
To correct this problem, the the error handling code in verify_list()
is modified so that it no longer frees list
. This change ensures that list
is freed only once, at the same level of abstraction, in the process_list()
function.
...