[Spice-devel] [PATCH v3 1/2] Do endian swapping.
Michal Suchánek
msuchanek at suse.de
Fri Jan 13 18:29:22 UTC 2017
On Fri, 13 Jan 2017 06:52:17 -0500 (EST)
Frediano Ziglio <fziglio at redhat.com> wrote:
> > case VD_AGENT_FILE_XFER_STATUS:
> > case VD_AGENT_FILE_XFER_DATA:
> > + if (message_header->size <
> > sizeof(VDAgentFileXferStartMessage))
> > + goto size_error;
> > + *id = GUINT32_FROM_LE(*id);
> > + id++; /* size/status */
> > + switch (message_header->type) {
> > + case VD_AGENT_FILE_XFER_DATA:
> > + if (message_header->size <
> > sizeof(VDAgentFileXferDataMessage))
> > + goto size_error;
> > + *((uint64_t *)id) = le64toh(*((uint64_t *)id)); /* size
> > */
>
> Why not GUINT64_FROM_LE ?
Missed the 64bit functions when changing to glib macros.
> There could be portability issues if id is not 64-bit aligned here.
> Would be better to use VDAgentFileXferDataMessage structure which
> has the right attributes to support misalignment.
yes, that might be better option.
Thanks
Michal
More information about the Spice-devel
mailing list