I am writing a program in C for Linux on an ARM9 processor. The program is designed to access network packets, which include a sequence of tagged data, for example:
<fieldID><length><data><fieldID><length><data> ...
The fieldID and length fields are uint16_t. Data can be 1 or more bytes (up to 64k if full length is used, but it is not).
As long as it <data>has an even number of bytes, I don't see a problem. But if I have a 1- or 3- or 5-byte <data>section, the next 16-bit field identifier does not end at the 16-bit boundary, and I expect alignment problems. It has been a while since I did something like this from scratch, so I'm a little unsure of the details. Any feedback is appreciated. Thanks.
source
share