test-logging: don't hard-code paths in /tmp
commit5f9f818ea88a013b2464563be354dd2f0f316407
authorSascha Silbe <silbe@linux.vnet.ibm.com>
Thu, 18 Aug 2016 18:46:03 +0000 (18 20:46 +0200)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 19 Aug 2016 11:44:11 +0000 (19 12:44 +0100)
tree01e9bee5a707f6274673e25b0e58808735793172
parent50455700092412d90ffaf57ee5d00f38f7d1cc5b
test-logging: don't hard-code paths in /tmp

Since f6880b7f [qemu-log: support simple pid substitution for logs],
test-logging creates files with hard-coded names in /tmp. In the best
case, this prevents multiple developers from running "make check" on
the same machine. In the worst case, it allows for symlink attacks,
enabling an attacker to overwrite files that are writable to the
developer running "make check".

Instead of hard-coding the paths, create a temporary directory using
g_dir_make_tmp() and clean it up afterwards.

Fixes: f6880b7f ("qemu-log: support simple pid substitution for logs")
Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Message-id: 1471545963-11720-3-git-send-email-silbe@linux.vnet.ibm.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
tests/test-logging.c