Closed GoogleCodeExporter closed 9 years ago
Doesn't the above fix repeat the problem on msg? Shouldn't it be
- memcpy(newMsg, msg, sizeof(message_t));
+ uint8_t payloadLength = getHeader(msg)->length;
+ memcpy(getHeader(newMsg), msg, sizeof(serial_header_t)+payloadLength);
Phil
Original comment by philip.l...@gmail.com
on 16 Dec 2010 at 11:51
I doubt your version will work.
The incomming packet (message_t* msg) is always from a serial forwarder which
have no idea about the header alignment of TOSSIM messages and will then be
aligned with msg->header. The new packet (message_t* newMsg) should have the
prober alignment so on this message_t we should use getHeader(newMsg).
Does this make sense?
Morten.
Original comment by mortenthansen
on 17 Dec 2010 at 1:44
It does. Sorry, it's been a long time since I saw this code; I forgot that the
message coming in will be aligned at the beginning of the struct, not the
proper header position. This actually suggests the typing of the functions is
wrong, as technically it's not a message_t being passed in. But oh well.
I'll test your fix on Monday and check it in if it works for me.
Original comment by philip.l...@gmail.com
on 18 Dec 2010 at 1:42
I applied your fix.
Original comment by philip.l...@gmail.com
on 22 Dec 2010 at 12:30
Original issue reported on code.google.com by
mortenthansen
on 24 Nov 2010 at 12:41