[pve-devel] [PATCH guest-common] Fix #1480: die if snapshot name is not found before set_lock is used

Alwin Antreich a.antreich at proxmox.com
Mon Aug 28 11:08:12 CEST 2017


Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---
 PVE/AbstractConfig.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/PVE/AbstractConfig.pm b/PVE/AbstractConfig.pm
index 64d19e4..82c495c 100644
--- a/PVE/AbstractConfig.pm
+++ b/PVE/AbstractConfig.pm
@@ -480,9 +480,13 @@ sub snapshot_delete {
 
     my $prepare = 1;
 
-    my $snap;
     my $unused = [];
 
+    my $conf = $class->load_config($vmid);
+    my $snap = $conf->{snapshots}->{$snapname};
+
+    die "snapshot '$snapname' does not exist\n" if !defined($snap);
+
     $class->set_lock($vmid, 'snapshot-delete')
 	if (!$drivehash); # doesn't already have a 'snapshot' lock
 
-- 
2.11.0





More information about the pve-devel mailing list