Index: util/mach/mach_message_util.cc |
diff --git a/util/mach/mach_message_util.cc b/util/mach/mach_message_util.cc |
index a1392fe01886f9bf7bb0b2d9b15a54bb6bb36b10..a6e61d1ed4fc012b13f6f35c9d7d68e6147ebf70 100644 |
--- a/util/mach/mach_message_util.cc |
+++ b/util/mach/mach_message_util.cc |
@@ -34,4 +34,11 @@ void SetMIGReplyError(mach_msg_header_t* out_header, kern_return_t error) { |
reinterpret_cast<mig_reply_error_t*>(out_header)->RetCode = error; |
} |
+const mach_msg_trailer_t* MachMessageTrailerFromHeader( |
+ const mach_msg_header_t* header) { |
+ vm_address_t header_address = reinterpret_cast<vm_address_t>(header); |
+ vm_address_t trailer_address = header_address + round_msg(header->msgh_size); |
+ return reinterpret_cast<const mach_msg_trailer_t*>(trailer_address); |
+} |
+ |
} // namespace crashpad |