MemTools: Always provide a valid pointer in send_msg for mach_msg_overwrite

This cannot be nullptr in macOS Ventura and iOS 16.
This commit is contained in:
OatmealDome 2022-06-12 00:19:09 -04:00
parent 05160d8d2e
commit 3e5f1a4f99
1 changed files with 1 additions and 3 deletions

View File

@ -157,7 +157,6 @@ static void ExceptionThread(mach_port_t port)
#pragma pack()
memset(&msg_in, 0xee, sizeof(msg_in));
memset(&msg_out, 0xee, sizeof(msg_out));
mach_msg_header_t* send_msg = nullptr;
mach_msg_size_t send_size = 0;
mach_msg_option_t option = MACH_RCV_MSG;
while (true)
@ -167,7 +166,7 @@ static void ExceptionThread(mach_port_t port)
// thread_set_exception_ports, or MACH_NOTIFY_NO_SENDERS due to
// mach_port_request_notification.
CheckKR("mach_msg_overwrite",
mach_msg_overwrite(send_msg, option, send_size, sizeof(msg_in), port,
mach_msg_overwrite(&msg_out.Head, option, send_size, sizeof(msg_in), port,
MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL, &msg_in.Head, 0));
if (msg_in.Head.msgh_id == MACH_NOTIFY_NO_SENDERS)
@ -216,7 +215,6 @@ static void ExceptionThread(mach_port_t port)
msg_out.Head.msgh_size =
offsetof(__typeof__(msg_out), new_state) + msg_out.new_stateCnt * sizeof(natural_t);
send_msg = &msg_out.Head;
send_size = msg_out.Head.msgh_size;
option |= MACH_SEND_MSG;
}