Posted by: fdmanana | December 22, 2009

Fixed a bug in Wireshark (ex Ethereal)

I noticed a small bug in Wireshark a few years ago, when it was known as Ethereal. I don’t know why but I never fixed the bug or reported it.

The problem was:  the IPv4 header field “flags” was being parsed as a 4 bits field while it should be a 3 bits field (the 3 high order bits of a 16 bits word).
So I decided to submit a patch, which got accepted and merged into the trunk:

A very simle patch. Nonetheless, I learned something new: the C preprocessor’s stringification.
I had the need to insert a constant in a string to be assigned to a char* field of a static variable, and whitin an initialisation statement. Using strcpy and related functions from string.h was out of question (as any other kind of C code).
The stringification was pointed to me by Guy Harris, one of the Wireshark commiters.

Thanks Guy Harris 🙂


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: