From cd163b81be73105facdd7e6707d27a96a6d4d588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 28 Apr 2015 03:21:31 +0200 Subject: [PATCH] dispvm: sanitize used memory info received from VM Luckily it is used as argument to commands with does not allow any harmful arguments (virsh set(max)mem). Also usage in arithmetic expression does not allow any harmful usage in this place. --- dispvm/qubes-prepare-saved-domain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dispvm/qubes-prepare-saved-domain.sh b/dispvm/qubes-prepare-saved-domain.sh index bbf9b487..6783a482 100755 --- a/dispvm/qubes-prepare-saved-domain.sh +++ b/dispvm/qubes-prepare-saved-domain.sh @@ -42,7 +42,7 @@ qubesdb-read -d $1 /qubes-gateway | \ kill `cat /var/run/qubes/guid-running.$ID` # FIXME: get connection URI from core scripts virsh -c xen:/// detach-disk $1 xvdb -MEM=$(qubesdb-read -d $1 /qubes-used-mem) +MEM=$(qubesdb-read -d $1 /qubes-used-mem | grep -q '^[0-9]\+$' | head -n 1) echo "DVM boot complete, memory used=$MEM. Saving image..." >&2 QMEMMAN_STOP=/var/run/qubes/do-not-membalance touch $QMEMMAN_STOP