Just allocate a pointer on the stack, read into it, and then assign the value into the provided space:
void *msg_ptr; read(..., &msg_ptr, sizeof msg_ptr); *data = msg_ptr;
Just allocate a pointer on the stack, read into it, and then assign the value into the provided space: