[Spice-devel] [vdagent-linux 1/3] Handle get_current_mon_config() failures

Christophe Fergeau cfergeau at redhat.com
Tue Sep 23 08:32:39 PDT 2014


get_current_mon_config() can return NULL, but
vdagent_x11_set_monitor_config() was calling it without checking if it's
NULL before dereferencing it.
This issue was pinpointed by Coverity.
---
 src/vdagent-x11-randr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c
index 46367bc..f48f045 100644
--- a/src/vdagent-x11-randr.c
+++ b/src/vdagent-x11-randr.c
@@ -735,6 +735,8 @@ void vdagent_x11_set_monitor_config(struct vdagent_x11 *x11,
     }
 
     curr = get_current_mon_config(x11);
+    if (!curr)
+        goto exit;
     if (same_monitor_configs(mon_config, curr) &&
            x11->width[0] == primary_w && x11->height[0] == primary_h) {
         goto exit;
-- 
1.9.3



More information about the Spice-devel mailing list