Skip to content
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

Fix use-after-free in json_tokener_new_ex() #722

Merged

Conversation

imaami
Copy link
Contributor

@imaami imaami commented Sep 4, 2021

The failure path taken in the event of printbuf_new() returning NULL
calls free() on tok->stack after already having freed tok. Swap the
order of the two calls to fix an obvious memory access violation.

Fixes: bcb6d7d ("Handle allocation failure in json_tokener_new_ex")
Signed-off-by: Juuso Alasuutari juuso.alasuutari@gmail.com

The failure path taken in the event of printbuf_new() returning NULL
calls free() on tok->stack after already having freed tok. Swap the
order of the two calls to fix an obvious memory access violation.

Fixes: bcb6d7d ("Handle allocation failure in json_tokener_new_ex")
Signed-off-by: Juuso Alasuutari <juuso.alasuutari@gmail.com>
@hawicz hawicz merged commit 4fc44f3 into json-c:master Sep 5, 2021
@imaami imaami deleted the fix-json_tokener_new_ex-use-after-free branch September 5, 2021 16:52
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

Successfully merging this pull request may close these issues.

None yet

2 participants