]> git.ipfire.org Git - thirdparty/json-c.git/commit
Fix use-after-free in json_tokener_new_ex() 722/head
authorJuuso Alasuutari <juuso.alasuutari@gmail.com>
Sat, 4 Sep 2021 17:14:30 +0000 (20:14 +0300)
committerJuuso Alasuutari <juuso.alasuutari@gmail.com>
Sat, 4 Sep 2021 17:14:30 +0000 (20:14 +0300)
commit9361d8d3a89475f5aadcac2c5473da1c4c47c7e2
treee0d3dd811673e4427d7c3ae1944ccb0fd931e176
parentdc1ef7d566e0857bb10772e9048198ba46bd1485
Fix use-after-free in json_tokener_new_ex()

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: bcb6d7d3474b ("Handle allocation failure in json_tokener_new_ex")
Signed-off-by: Juuso Alasuutari <juuso.alasuutari@gmail.com>
json_tokener.c