MSI: eliminate some fixed length buffers
Mike McCormack
mike at codeweavers.com
Fri Dec 24 00:47:42 CST 2004
ChangeLog:
<aric at codeweavers.com>
* eliminate some fixed length buffers
-------------- next part --------------
--- dlls/msi/action.c.old 2004-12-24 15:45:55.000000000 +0900
+++ dlls/msi/action.c 2004-12-24 15:46:07.000000000 +0900
@@ -742,8 +742,8 @@
while (*ptr)
{
- WCHAR prop[0x100];
- WCHAR val[0x100];
+ WCHAR *prop = NULL;
+ WCHAR *val = NULL;
TRACE("Looking at %s\n",debugstr_w(ptr));
@@ -754,10 +754,13 @@
DWORD len = 0;
while (*ptr == ' ') ptr++;
- strncpyW(prop,ptr,ptr2-ptr);
- prop[ptr2-ptr]=0;
+ len = ptr2-ptr;
+ prop = HeapAlloc(GetProcessHeap(),0,(len+1)*sizeof(WCHAR));
+ strncpyW(prop,ptr,len);
+ prop[len]=0;
ptr2++;
-
+
+ len = 0;
ptr = ptr2;
while (*ptr && (quote || (!quote && *ptr!=' ')))
{
@@ -772,8 +775,9 @@
ptr2++;
len -= 2;
}
+ val = HeapAlloc(GetProcessHeap(),0,(len+1)*sizeof(WCHAR));
strncpyW(val,ptr2,len);
- val[len]=0;
+ val[len] = 0;
if (strlenW(prop) > 0)
{
@@ -781,6 +785,8 @@
debugstr_w(prop), debugstr_w(val));
MSI_SetPropertyW(package,prop,val);
}
+ HeapFree(GetProcessHeap(),0,val);
+ HeapFree(GetProcessHeap(),0,prop);
}
ptr++;
}
@@ -1335,6 +1341,7 @@
if (type & 0xc0)
{
+#if 0
DWORD ThreadId;
HANDLE ThreadHandle;
thread_struct *info = HeapAlloc( GetProcessHeap(), 0, sizeof(*info) );
@@ -1347,6 +1354,7 @@
ThreadHandle = CreateThread(NULL,0,DllThread,(LPVOID)info,0,&ThreadId);
CloseHandle(ThreadHandle);
/* FIXME: release the package if the CreateThread fails */
+#endif
return ERROR_SUCCESS;
}
@@ -2361,7 +2369,7 @@
}
else
{
- if (file->Version[0])
+ if (file->Version)
{
DWORD handle;
DWORD versize;
@@ -2872,7 +2880,10 @@
rc = 0;
}
else
- break;
+ {
+ ERR("Ignoring Error and continuing...\n");
+ rc = 0;
+ }
}
else
file->State = 4;
More information about the wine-patches
mailing list