From: VMware, Inc <> Date: Wed, 24 Feb 2010 22:21:45 +0000 (-0800) Subject: Unity: Strengthen Tools' "unity.desktop.work_area.set" handler a smidge. X-Git-Tag: 2010.02.23-236320~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b40292252c813be3755f872497893daa1ff6512;p=thirdparty%2Fopen-vm-tools.git Unity: Strengthen Tools' "unity.desktop.work_area.set" handler a smidge. 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 --- diff --git a/open-vm-tools/lib/unity/unity.c b/open-vm-tools/lib/unity/unity.c index 9c8049b79..5ca707962 100644 --- a/open-vm-tools/lib/unity/unity.c +++ b/open-vm-tools/lib/unity/unity.c @@ -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)) {