]> git.proxmox.com Git - pve-guest-common.git/commitdiff
Fix #1480: die if snapshot name is not found before set_lock is used
authorAlwin Antreich <a.antreich@proxmox.com>
Mon, 28 Aug 2017 09:08:12 +0000 (11:08 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 1 Sep 2017 07:06:24 +0000 (09:06 +0200)
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
PVE/AbstractConfig.pm

index 64d19e4c75ff32ff4e447206728dc68cfb88a6b6..347398854e1cbb0e585d8aaa5eff2ba056e81e7c 100644 (file)
@@ -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