mirror of
				https://git.proxmox.com/git/qemu-server
				synced 2025-11-04 14:28:13 +00:00 
			
		
		
		
	api: termproxy/vncproxy: fix 'use of uninitialized value' when checking vga type
in our schema for 'vga' the type is optional, so a config like vga: memory=64 is valid. When checking the type we have to check if the type is defined before accessing it. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> [FE: add 'termproxy/vncproxy' prefix to commit title] Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
		
							parent
							
								
									664c50a1c6
								
							
						
					
					
						commit
						45f67709ea
					
				@ -2573,7 +2573,7 @@ __PACKAGE__->register_method({
 | 
				
			|||||||
	my $serial;
 | 
						my $serial;
 | 
				
			||||||
	if ($conf->{vga}) {
 | 
						if ($conf->{vga}) {
 | 
				
			||||||
	    my $vga = PVE::QemuServer::parse_vga($conf->{vga});
 | 
						    my $vga = PVE::QemuServer::parse_vga($conf->{vga});
 | 
				
			||||||
	    $serial = $vga->{type} if $vga->{type} =~ m/^serial\d+$/;
 | 
						    $serial = $vga->{type} if defined($vga->{type}) && $vga->{type} =~ m/^serial\d+$/;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	my $authpath = "/vms/$vmid";
 | 
						my $authpath = "/vms/$vmid";
 | 
				
			||||||
@ -2723,7 +2723,7 @@ __PACKAGE__->register_method({
 | 
				
			|||||||
	if (!defined($serial)) {
 | 
						if (!defined($serial)) {
 | 
				
			||||||
	    if ($conf->{vga}) {
 | 
						    if ($conf->{vga}) {
 | 
				
			||||||
		my $vga = PVE::QemuServer::parse_vga($conf->{vga});
 | 
							my $vga = PVE::QemuServer::parse_vga($conf->{vga});
 | 
				
			||||||
		$serial = $vga->{type} if $vga->{type} =~ m/^serial\d+$/;
 | 
							$serial = $vga->{type} if defined($vga->{type}) && $vga->{type} =~ m/^serial\d+$/;
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user