Skip to content

Commit

Permalink
Use after free reported in TokTok#278 occurs because toxav_kill()
Browse files Browse the repository at this point in the history
calls msi_kill() (toxav.c:180) which frees msi_call instances (msi.c:161)
which are then used when call_remove() (toxav.c:1136) is called.
This fix prevents call_remove() from calling invalid pointer.

Fixes TokTok#278
  • Loading branch information
mannol committed Dec 20, 2016
1 parent de623f9 commit 7122d2e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions toxav/toxav.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ void toxav_kill(ToxAV *av)

while (it) {
call_kill_transmission(it);
it->msi_call = NULL; /* msi_kill() frees the call's msi_call handle; which causes #278 */
it = call_remove(it); /* This will eventually free av->calls */
}
}
Expand Down

0 comments on commit 7122d2e

Please sign in to comment.