core: msg_send_receive() corrupts the input

`tcb_t::wait_data` is used both to send data and receive data.

This leads to the corruption of the paramter `m` in `msg_send_receive()`
if the target thread is not receive blocked and has no (or a full)
message queue.

This PR fixes the problem by writing the input message into a variable
on the stack first.