qemu/io
Daniel P. Berrange 7b3c618ad0 io: fix stack allocation when sending of file descriptors
When sending file descriptors over a socket, we have to
allocate a data buffer to hold the FDs in the scmsghdr.
Unfortunately we allocated the buffer on the stack inside
an if () {} block, but called sendmsg() outside the block.
So the stack bytes holding the FDs were liable to be
overwritten with other data. By luck this was not a problem
when sending 1 FD, but if sending 2 or more then it would
fail.

The fix is to simply move the variables outside the nested
'if' block. To keep valgrind quiet we also zero-initialize
the 'control' buffer.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-12-23 10:53:03 +00:00
..
channel-buffer.c io: add QIOChannelBuffer class 2015-12-18 12:18:31 +00:00
channel-command.c io: add QIOChannelCommand class 2015-12-18 12:18:31 +00:00
channel-file.c io: add QIOChannelFile class 2015-12-18 12:18:31 +00:00
channel-socket.c io: fix stack allocation when sending of file descriptors 2015-12-23 10:53:03 +00:00
channel-tls.c io: add QIOChannelTLS class 2015-12-18 12:18:31 +00:00
channel-watch.c io: add helper module for creating watches on FDs 2015-12-18 12:18:05 +00:00
channel-websock.c io: add QIOChannelWebsock class 2015-12-18 12:18:31 +00:00
channel.c io: add abstract QIOChannel classes 2015-12-18 12:18:05 +00:00
Makefile.objs io: add QIOChannelBuffer class 2015-12-18 12:18:31 +00:00
task.c io: add QIOTask class for async operations 2015-12-18 12:18:30 +00:00