qemu-e2k/util
Daniel P. Berrange ad9579aaa1 sockets: improve error reporting if UNIX socket path is too long
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>
2017-06-07 18:22:02 +02:00
..
acl.c
aio-posix.c
aio-win32.c
aiocb.c
async.c async: Introduce aio_co_enter 2017-04-11 20:07:15 +08:00
base64.c
bitmap.c bitmap: add bitmap_copy_and_clear_atomic 2017-04-24 10:12:28 +02:00
bitops.c
buffer.c
bufferiszero.c
compatfd.c cpus: remove ugly cast on sigbus_handler 2017-03-03 16:40:02 +01:00
coroutine-sigaltstack.c
coroutine-ucontext.c
coroutine-win32.c
crc32c.c
cutils.c utils: provide size_to_str() 2017-05-17 17:30:45 +01:00
envlist.c util: Use g_malloc/g_free in envlist.c 2017-05-07 09:57:51 +03:00
error.c util/error: Fix leak in error_vprepend() 2017-04-24 09:12:59 +02:00
event_notifier-posix.c Remove/replace sysemu/char.h inclusion 2017-06-02 11:33:52 +04:00
event_notifier-win32.c event_notifier: prevent accidental use after close 2017-03-29 02:35:23 +03:00
fifo8.c
getauxval.c
hbitmap.c
hexdump.c
host-utils.c
id.c
iohandler.c
iov.c
keyval.c qapi: Reject alternates that can't work with keyval_parse() 2017-05-31 16:04:09 +02:00
lockcnt.c
log.c util/cutils: Rename qemu_strtoll(), qemu_strtoull() 2017-02-23 20:35:35 +01:00
main-loop.c main-loop: Acquire main_context lock around os_host_main_loop_wait. 2017-04-03 19:13:12 +02:00
Makefile.objs qemu-ga: obey LISTEN_PID when using systemd socket activation 2017-03-19 11:12:12 +01:00
memfd.c
mmap-alloc.c exec, kvm, target-ppc: Move getrampagesize() to common code 2017-03-03 11:30:59 +11:00
module.c
notify.c
osdep.c osdep: Fall back to posix lock when OFD lock is unavailable 2017-05-11 11:15:32 +02:00
oslib-posix.c Check the return value of fcntl in qemu_set_cloexec 2017-06-06 20:18:35 +02:00
oslib-win32.c mem-prealloc: reduce large guest start-up and migration time. 2017-03-14 13:26:36 +01:00
path.c util: Removed unneeded header from path.c 2017-03-14 13:26:37 +01:00
qdist.c
qemu-config.c util/qemu-config: Add loadparm to qemu machine_opts 2017-05-02 15:08:54 +02:00
qemu-coroutine-io.c
qemu-coroutine-lock.c coroutine-lock: make CoRwlock thread-safe and fair 2017-02-21 11:39:40 +00:00
qemu-coroutine-sleep.c
qemu-coroutine.c coroutine: Extract qemu_aio_coroutine_enter 2017-04-11 20:07:15 +08:00
qemu-error.c
qemu-openpty.c
qemu-option.c QemuOpts: Simplify qemu_opts_to_qdict() 2017-05-09 09:14:39 +02:00
qemu-progress.c progress: Show current progress on SIGINFO 2017-04-28 18:48:11 +02:00
qemu-sockets.c sockets: improve error reporting if UNIX socket path is too long 2017-06-07 18:22:02 +02:00
qemu-thread-posix.c trace: add qemu mutex lock and unlock trace events 2017-05-05 12:09:59 +02:00
qemu-thread-win32.c trace: add qemu mutex lock and unlock trace events 2017-05-05 12:09:59 +02:00
qemu-timer-common.c
qemu-timer.c icount: process QEMU_CLOCK_VIRTUAL timers in vCPU thread 2017-03-14 13:51:34 +01:00
qht.c
range.c
rcu.c
readline.c
systemd.c qemu-ga: obey LISTEN_PID when using systemd socket activation 2017-03-19 11:12:12 +01:00
thread-pool.c thread-pool: add missing qemu_bh_cancel in completion function 2017-03-17 12:54:21 +01:00
throttle.c throttle: make throttle_config(throttle_get_config()) symmetric 2017-04-21 10:36:12 +01:00
timed-average.c
trace-events trace: add qemu mutex lock and unlock trace events 2017-05-05 12:09:59 +02:00
unicode.c
uri.c
uuid.c