ad9579aaa1
The 'struct sockaddr_un' only allows 108 bytes for the socket path. If the user supplies a path, QEMU uses snprintf() to silently truncate it when too long. This is undesirable because the user will then be unable to connect to the path they asked for. If the user doesn't supply a path, QEMU builds one based on TMPDIR, but if that leads to an overlong path, it mistakenly uses error_setg_errno() with a stale errno value, because snprintf() does not set errno on truncation. In solving this the code needed some refactoring to ensure we don't pass 'un.sun_path' directly to any APIs which expect NUL-terminated strings, because the path is not required to be terminated. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <20170525155300.22743-1-berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |
||
---|---|---|
.. | ||
acl.c | ||
aio-posix.c | ||
aio-win32.c | ||
aiocb.c | ||
async.c | ||
base64.c | ||
bitmap.c | ||
bitops.c | ||
buffer.c | ||
bufferiszero.c | ||
compatfd.c | ||
coroutine-sigaltstack.c | ||
coroutine-ucontext.c | ||
coroutine-win32.c | ||
crc32c.c | ||
cutils.c | ||
envlist.c | ||
error.c | ||
event_notifier-posix.c | ||
event_notifier-win32.c | ||
fifo8.c | ||
getauxval.c | ||
hbitmap.c | ||
hexdump.c | ||
host-utils.c | ||
id.c | ||
iohandler.c | ||
iov.c | ||
keyval.c | ||
lockcnt.c | ||
log.c | ||
main-loop.c | ||
Makefile.objs | ||
memfd.c | ||
mmap-alloc.c | ||
module.c | ||
notify.c | ||
osdep.c | ||
oslib-posix.c | ||
oslib-win32.c | ||
path.c | ||
qdist.c | ||
qemu-config.c | ||
qemu-coroutine-io.c | ||
qemu-coroutine-lock.c | ||
qemu-coroutine-sleep.c | ||
qemu-coroutine.c | ||
qemu-error.c | ||
qemu-openpty.c | ||
qemu-option.c | ||
qemu-progress.c | ||
qemu-sockets.c | ||
qemu-thread-posix.c | ||
qemu-thread-win32.c | ||
qemu-timer-common.c | ||
qemu-timer.c | ||
qht.c | ||
range.c | ||
rcu.c | ||
readline.c | ||
systemd.c | ||
thread-pool.c | ||
throttle.c | ||
timed-average.c | ||
trace-events | ||
unicode.c | ||
uri.c | ||
uuid.c |