Skip to content

Double-free vulnerability in contrib/shpsort.c #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eldstal opened this issue Dec 29, 2021 · 3 comments
Closed

Double-free vulnerability in contrib/shpsort.c #39

eldstal opened this issue Dec 29, 2021 · 3 comments

Comments

@eldstal
Copy link
Contributor

eldstal commented Dec 29, 2021

Summary

The buffer copy is freed twice, leading to possible memory corruption or vulnerability.

Cause

In split(), at shpsort.c:107, the buffer copy is free'd. realloc() fails on line 110, the buffer copy is freed again at shpsort.c:116.

Impact

A double-free bug can lead to an attacker gaining control over the values returned from malloc(), which in turn may allow both disclosure of sensitive data (e.g. bypassing additional safety features) or in the worst case hostile code execution.

Vulnerable version

Proposed mitigation

Remove line 116, as it is redundant.

@mloskot
Copy link
Member

mloskot commented Jan 3, 2022

Instead of opening the issue, a pull request could be a time saver

eldstal added a commit to eldstal/shapelib that referenced this issue Jan 3, 2022
@eldstal
Copy link
Contributor Author

eldstal commented Jan 3, 2022

Fair point.

rouault added a commit that referenced this issue Jan 3, 2022
Remove double free() in contrib/shpsrt, issue #39
@rouault rouault closed this as completed Jan 3, 2022
@eldstal
Copy link
Contributor Author

eldstal commented Feb 22, 2022

This vulnerability has been assigned CVE-2022-0699 by the Red Hat CNA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants