mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-26 21:30:17 +00:00
fix memory corruption on client due to mach vm dealloc
This commit is contained in:
parent
32d85ffe9b
commit
62db503302
3 changed files with 5 additions and 3 deletions
|
@ -91,7 +91,7 @@ char* mach_send_message(mach_port_t port, char* message, uint32_t len, bool awai
|
|||
msg.descriptor.address = message;
|
||||
msg.descriptor.size = len * sizeof(char);
|
||||
msg.descriptor.copy = MACH_MSG_VIRTUAL_COPY;
|
||||
msg.descriptor.deallocate = await_response;
|
||||
msg.descriptor.deallocate = false;
|
||||
msg.descriptor.type = MACH_MSG_OOL_DESCRIPTOR;
|
||||
|
||||
mach_msg(&msg.header,
|
||||
|
|
|
@ -678,9 +678,10 @@ void handle_message_mach(struct mach_buffer* buffer) {
|
|||
out:
|
||||
if (rsp) fclose(rsp);
|
||||
|
||||
response[length] = '\0';
|
||||
mach_send_message(buffer->message.header.msgh_remote_port, response,
|
||||
length,
|
||||
false );
|
||||
length + 1,
|
||||
false );
|
||||
if (response) free(response);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ static int client_send_message(int argc, char **argv) {
|
|||
message_length,
|
||||
true );
|
||||
|
||||
free(message);
|
||||
if (!rsp) return EXIT_SUCCESS;
|
||||
|
||||
printf("%s", rsp);
|
||||
|
|
Loading…
Reference in a new issue