]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Unity: Strengthen Tools' "unity.desktop.work_area.set" handler a smidge.
authorVMware, Inc <>
Wed, 24 Feb 2010 22:21:45 +0000 (14:21 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Wed, 24 Feb 2010 22:21:45 +0000 (14:21 -0800)
Once again, manual marshalling has bitten us in the ass.  While working
on bug 522656, I discovered that vmware-user was crashing in the region
code, because it was creating regions with invalid dimensions.

Said regions were created from bogus coordinates like this:
Breakpoint 1, UnityTcloSetDesktopWorkArea (result=0x7fff2ed6e980,
resultLen=0x7fff2ed6e978, name=0x2768d90 "unity.desktop.work_area.set",
args=0x275a1fb " 1 , 0 -195 1600 1200", argsSize=21, clientData=0x0)
at /mts/dbc8-a/rbeasley/p4/hosted09/bora-vmsoft/lib/unity/unity.c:854
854 {

This change adds a test s.t. x and y must be >= 0, and width and height
must be >0.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/unity/unity.c

index 9c8049b79b08b9e6d6c66f4b84bf1a58108d7eed..5ca7079623980e2bebe59754374a07d409ae8ae8 100644 (file)
@@ -910,6 +910,12 @@ UnityTcloSetDesktopWorkArea(char const **result,  // IN
                           FALSE);
          goto out;
       }
+
+      if (workAreas[i].x < 0 || workAreas[i].y < 0 ||
+          workAreas[i].width <= 0 || workAreas[i].height <= 0) {
+         RpcIn_SetRetVals(result, resultLen, "Invalid argument", FALSE);
+         goto out;
+      }
    }
 
    if (!UnityPlatformSetDesktopWorkAreas(unity.up, workAreas, count)) {