Wireshark mailing list archives

Re: [Wireshark-dev] Familiar with gtk/sctp_graph_dlg.c?


From: Christopher Maynard <Christopher.Maynard () gtech com>
Date: Tue, 26 Apr 2011 12:01:57 +0000 (UTC)

Michael Tüxen <Michael.Tuexen@...> writes:

dup_list = (guint32 *)((char *)sack_header + 16 + (nr*sizeof(struct gaps)))

Clang likes something that doesn't involve casting a "char *", which is not
guaranteed to contain an
address that's 4-byte aligned, to a "guint32 *", which is a pointer that's
supposed to be 4-byte aligned...

...and that, on at least some architectures, *MUST* be 4-byte aligned in
order for dereferences of it to work!
The fields in the packet are 4 byte aligned. But if the whole structure might
not...
So should we copy them?

Would something like this [untested code] help?

dup_list = (guint32 *)sack_header + (sizeof(struct sack_chunk_header) -
sizeof(struct gaps) + (nr * sizeof(struct gaps)) / sizeof(guint32);



___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: