setupapi: Fix buffer overflow in load_fake_dll.
Found by Daniel Lehman.
This commit is contained in:
parent
8ed96ab041
commit
8418115edf
|
@ -394,13 +394,13 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
|
|||
if ((p = strrchrW( name, '\\' ))) name = p + 1;
|
||||
|
||||
i = 0;
|
||||
if (build_dir) maxlen = strlen(build_dir) + sizeof("/programs/") + strlenW(name);
|
||||
len = strlenW( name );
|
||||
if (build_dir) maxlen = strlen(build_dir) + sizeof("/programs/") + len;
|
||||
while ((path = wine_dll_enum_load_path( i++ ))) maxlen = max( maxlen, strlen(path) );
|
||||
maxlen += sizeof("/fakedlls") + strlenW(name) + 2;
|
||||
maxlen += sizeof("/fakedlls") + len + sizeof(".fake");
|
||||
|
||||
if (!(file = HeapAlloc( GetProcessHeap(), 0, maxlen ))) return NULL;
|
||||
|
||||
len = strlenW( name );
|
||||
pos = maxlen - len - sizeof(".fake");
|
||||
if (!dll_name_WtoA( file + pos, name, len )) goto done;
|
||||
file[--pos] = '/';
|
||||
|
|
Loading…
Reference in New Issue