diff options
author | Frediano Ziglio <freddy77@gmail.com> | 2020-09-25 16:06:08 +0100 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2020-10-21 16:19:47 +0100 |
commit | 8698e1e5ccfd9ddf5e99e2c990476e74f97889c9 (patch) | |
tree | 04918088a85e7d3f0bdee58f092502ddcc8dc8a0 | |
parent | aab670b3b705c8d6d870e12efd1cdfe2eaf41aeb (diff) |
vdagentd: Fix clipboard serial for big endian machines
The GUINT32_TO_LE in case of big endian machine can expand
the argument multiple times so avoid to pass argument that
could have side effects.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@redhat.com>
-rw-r--r-- | src/vdagentd/vdagentd.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c index 9444c32..dca6980 100644 --- a/src/vdagentd/vdagentd.c +++ b/src/vdagentd/vdagentd.c @@ -680,7 +680,8 @@ static void virtio_write_clipboard(uint8_t selection, uint32_t msg_type, if (msg_type == VD_AGENT_CLIPBOARD_GRAB) { if (VD_AGENT_HAS_CAPABILITY(capabilities, capabilities_size, VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL)) { - uint32_t serial = GUINT32_TO_LE(clipboard_serial[selection]++); + uint32_t serial = GUINT32_TO_LE(clipboard_serial[selection]); + clipboard_serial[selection]++; vdagent_virtio_port_write_append(virtio_port, (uint8_t*)&serial, sizeof(serial)); } virtio_msg_uint32_to_le(data, data_size, 0); |