[riot-notifications] [RIOT] change length field size in packet_t to two bytes (#159)

LudwigOrtmann notifications at github.com
Sun Aug 18 08:07:59 CEST 2013


> @@ -60,9 +60,9 @@ void _native_handle_tap_input(void)
>              }
>              else {
>                  /* XXX: check overflow */
> -                p.length = (uint8_t)buf[ETHER_HDR_LEN];
> -                p.dst = (uint8_t)buf[ETHER_HDR_LEN+1];
> -                p.data = buf+ETHER_HDR_LEN+2;
> +                memcpy(&p.length, &buf[ETHER_HDR_LEN], sizeof(uint16_t));

Un-/marshalling (same error below) needs to take care of byte order. Use htonX/ntohX for any numeric bigger than a byte.

---
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/159/files#r5830684
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20130817/faa2bc9c/attachment.html>


More information about the notifications mailing list