summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2015-10-01 15:50:52 +0300
committerMichael S. Tsirkin <mst@redhat.com>2015-10-02 17:04:32 +0300
commit6fdac09370530be0cc6fe9e8d425c0670ba994b1 (patch)
tree852867b9e0435ae10956d00dc5267a7604ce1d2f /tests
parent1b7e1e3b463a6e5c117498b192cb07603c04b668 (diff)
downloadhqemu-6fdac09370530be0cc6fe9e8d425c0670ba994b1.zip
hqemu-6fdac09370530be0cc6fe9e8d425c0670ba994b1.tar.gz
vhost-user-test: fix predictable filename on tmpfs
vhost-user-test uses getpid to create a unique filename. This name is predictable, and a security problem. Instead, use a tmp directory created by mkdtemp, which is a suggested best practice. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/vhost-user-test.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 5e63cbc..56df5cc 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -330,7 +330,7 @@ int main(int argc, char **argv)
root = tmpfs;
}
- socket_path = g_strdup_printf("/tmp/vhost-%d.sock", getpid());
+ socket_path = g_strdup_printf("%s/vhost.sock", tmpfs);
/* create char dev and add read handlers */
qemu_add_opts(&qemu_chardev_opts);
OpenPOWER on IntegriCloud