Skip to content

Commit

Permalink
Merge pull request ish-app#450 from stek29/fix-onexit-uaf
Browse files Browse the repository at this point in the history
Fix UAF in ios_handle_exit
  • Loading branch information
tbodt authored Jul 26, 2019
2 parents f564a8c + 0c6bef6 commit f545efc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ static void ios_handle_exit(struct task *task, int code) {
// this is called with pids_lock as an implementation side effect, please do not cite as an example of good API design
if (task->parent != NULL && task->parent->parent != NULL)
return;
// pid should be saved now since task would be freed
pid_t pid = task->pid;
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:ProcessExitedNotification
object:nil
userInfo:@{@"pid": @(task->pid),
userInfo:@{@"pid": @(pid),
@"code": @(code)}];
});
}
Expand Down

0 comments on commit f545efc

Please sign in to comment.