ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Possibly unsafe padding in Yahoo dissectors?

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Mon, 21 May 2012 14:37:56 -0700
On May 21, 2012, at 2:21 PM, Evan Huus wrote:

> So my question is what people feel the best style is in this situation?
> 
> 1. Replace the structure with a #define of the length, possibly
> leaving the struct #if 0'ed out for posterity.
> 
> 2. Add some compiler hints to never pad the struct, but leave it as is.
> 
> 3. Use this pattern in other places (possibly with the compiler hints
> as per 2), since the self-documentation is a good thing.

I vote for 1), and either put the struct into a comment or replace the struct with a description of the packet format, in, for example, prose form, or "boxes made out of plus signs and hyphens" form or....

2) can be compiler-dependent, and not all compilers necessarily support those hints.