summaryrefslogtreecommitdiff
path: root/qemu-nbd.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2017-05-25 16:53:00 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2017-06-07 18:22:02 +0200
commitad9579aaa16d5b385922d49edac2c96c79bcfb62 (patch)
treee5c01384ad220119c515d074354991ea96304722 /qemu-nbd.c
parent5b003a40bb1ab14d0398e91f03393d3c6b9577cd (diff)
downloadqemu-ad9579aaa16d5b385922d49edac2c96c79bcfb62.tar.gz
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>
Diffstat (limited to 'qemu-nbd.c')
0 files changed, 0 insertions, 0 deletions