MSI: fix buffer overflow

Mike McCormack mike at codeweavers.com
Tue Jun 29 07:24:48 CDT 2004


ChangeLog:
* fix buffer overflow
-------------- next part --------------
diff -ur dlls/msi.old/record.c dlls/msi/record.c
--- dlls/msi.old/record.c	2004-06-29 07:22:57.000000000 -0500
+++ dlls/msi/record.c	2004-06-29 07:23:10.000000000 -0500
@@ -349,7 +349,7 @@
         return ERROR_INVALID_FIELD;
 
     len = MultiByteToWideChar( CP_ACP, 0, szValue, -1, NULL, 0 );
-    str = HeapAlloc( GetProcessHeap(), 0, len );
+    str = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
     MultiByteToWideChar( CP_ACP, 0, szValue, -1, str, len );
     MSI_FreeField( &rec->fields[iField] );
     rec->fields[iField].type = MSIFIELD_WSTR;
@@ -372,7 +372,7 @@
     if( iField > rec->count )
         return ERROR_INVALID_FIELD;
 
-    str = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(szValue) + 1)*sizeof str[0]);
+    str = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(szValue) + 1)*sizeof (WCHAR));
     lstrcpyW( str, szValue );
 
     MSI_FreeField( &rec->fields[iField] );


More information about the wine-patches mailing list