File: Fix-VDAGentMonitorConfig-size-calculation.patch

package info (click to toggle)
spice-vdagent 0.22.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,448 kB
  • sloc: ansic: 8,323; sh: 1,480; makefile: 198
file content (28 lines) | stat: -rw-r--r-- 1,349 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From: Lukas Joeressen <lukas@joeressen.net>
Date: Sat, 12 Apr 2025 10:42:02 +0200
Subject: Fix VDAGentMonitorConfig size calculation

The VDAgentMonitorsConfig struct has the VD_AGENT_CONFIG_MONITORS_FLAG_PHYSICAL_SIZE flag that
indicates if physical monitor sizes are included in the data. If this flag is set there is one
instance of VDAgentMonitorMM for each monitor following the other data.

Origin: upstream, https://gitlab.freedesktop.org/spice/linux/vd_agent/-/commit/3660acfc
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/spice-vdagent/+bug/2086533
---
 src/vdagentd/vdagentd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c
index 3e59331..27a6f15 100644
--- a/src/vdagentd/vdagentd.c
+++ b/src/vdagentd/vdagentd.c
@@ -208,6 +208,9 @@ static void do_client_monitors(VirtioPort *vport, int port_nr,
     /* Store monitor config to send to agents when they connect */
     size = sizeof(VDAgentMonitorsConfig) +
            new_monitors->num_of_monitors * sizeof(VDAgentMonConfig);
+    if (new_monitors->flags & VD_AGENT_CONFIG_MONITORS_FLAG_PHYSICAL_SIZE) {
+        size += new_monitors->num_of_monitors * sizeof(VDAgentMonitorMM);
+    }
     if (message_header->size != size) {
         syslog(LOG_ERR, "invalid message size for VDAgentMonitorsConfig");
         return;