public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] api: fix 'use of uninitialized value' when checking vga type
@ 2025-03-05 11:06 Dominik Csapak
  2025-03-05 13:45 ` [pve-devel] applied: " Fiona Ebner
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2025-03-05 11:06 UTC (permalink / raw)
  To: pve-devel

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>
---
 PVE/API2/Qemu.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 5ac61aa5..dc8915a7 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2573,7 +2573,7 @@ __PACKAGE__->register_method({
 	my $serial;
 	if ($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";
@@ -2723,7 +2723,7 @@ __PACKAGE__->register_method({
 	if (!defined($serial)) {
 	    if ($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+$/;
 	    }
 	}
 
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH qemu-server] api: fix 'use of uninitialized value' when checking vga type
  2025-03-05 11:06 [pve-devel] [PATCH qemu-server] api: fix 'use of uninitialized value' when checking vga type Dominik Csapak
@ 2025-03-05 13:45 ` Fiona Ebner
  0 siblings, 0 replies; 2+ messages in thread
From: Fiona Ebner @ 2025-03-05 13:45 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 05.03.25 um 12:06 schrieb Dominik Csapak:
> 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>

applied, thanks! Added a 'termproxy/vncproxy' prefix to the commit title
for additional context.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-05 13:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-05 11:06 [pve-devel] [PATCH qemu-server] api: fix 'use of uninitialized value' when checking vga type Dominik Csapak
2025-03-05 13:45 ` [pve-devel] applied: " Fiona Ebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal