From 67c198552b6f3b0b1be358a2412bf4ccc6b619d5 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 30 Dec 2013 09:19:46 -0500 Subject: [PATCH] qubes-restore: guard against falling off the start of the buffer --- dispvm/qubes-restore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dispvm/qubes-restore.c b/dispvm/qubes-restore.c index 8717835a..16866b19 100644 --- a/dispvm/qubes-restore.c +++ b/dispvm/qubes-restore.c @@ -226,9 +226,9 @@ char *get_vmname_from_savefile(int fd) } *name = 0; slash = name - 1; - while (slash[0] && slash[0] != '/') + while (slash >= buf && slash[0] && slash[0] != '/') slash--; - if (!*slash) { + if (slash < buf || !*slash) { fprintf(stderr, "cannot find / in savefile\n"); exit(1); }