From: VMware, Inc <> Date: Tue, 29 Mar 2011 18:54:21 +0000 (-0700) Subject: Unity/X11: Gracefully handle NULL desktop work area RPCs. X-Git-Tag: 2011.03.28-387002~76 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d5e1d5fadeb599af893a3e32136301e04fc7e8a3;p=thirdparty%2Fopen-vm-tools.git Unity/X11: Gracefully handle NULL desktop work area RPCs. Should the host UI issue an RPC like unity.desktop.work_area.set 0 Unity/X11 will explode with a NULL pointer dereference, because of an incorrect assumption that there would be at least 1 parameter. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/services/plugins/unity/unitylib/unityPlatformX11.cc b/open-vm-tools/services/plugins/unity/unitylib/unityPlatformX11.cc index e62cdf872..8c46380b2 100644 --- a/open-vm-tools/services/plugins/unity/unitylib/unityPlatformX11.cc +++ b/open-vm-tools/services/plugins/unity/unitylib/unityPlatformX11.cc @@ -2293,6 +2293,13 @@ UnityPlatformSetDesktopWorkAreas(UnityPlatform *up, // IN screenInfo->height = rootHeight; } + if ((uint32)numScreens != numWorkAreas) { + Warning("Mismatch between host-specified work areas and available " + "screens. Request dropped.\n"); + free(screenInfo); + return FALSE; + } + /* * New and improved wild'n'crazy scheme to map the host's work area * coordinates to a collection of struts.