Skip to content

Commit

Permalink
Merge pull request otya128#1406 from cracyc/scanbin
Browse files Browse the repository at this point in the history
make pointer in callproc32w16 null if invalid and special case nul in…
  • Loading branch information
otya128 authored Jun 21, 2024
2 parents 3831738 + 42bb826 commit 50dcdb9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
15 changes: 10 additions & 5 deletions krnl386/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,11 +804,16 @@ HFILE16 WINAPI OpenFile16( LPCSTR name, OFSTRUCT *ofs, UINT16 mode )
}
goto error;
}
pathw = strdupAtoW(path);
found = SearchPathW( pathw, filename, NULL, sizeof(ofs->szPathName),
pathname, NULL );
HeapFree( GetProcessHeap(), 0, path );
HeapFree( GetProcessHeap(), 0, pathw );
if (!wcsicmp(pathname, L"\\\\.\\nul"))
found = TRUE;
else
{
pathw = strdupAtoW(path);
found = SearchPathW( pathw, filename, NULL, sizeof(ofs->szPathName),
pathname, NULL );
HeapFree( GetProcessHeap(), 0, path );
HeapFree( GetProcessHeap(), 0, pathw );
}
if (!found)
{
RtlInitUnicodeString(&uni, pathname);
Expand Down
5 changes: 4 additions & 1 deletion krnl386/thunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2531,7 +2531,10 @@ DWORD WINAPIV CallProc32W16( DWORD nrofargs, DWORD argconvmask, FARPROC proc32,
{
SEGPTR ptr = VA_ARG16( valist, SEGPTR );
/* pascal convention, have to reverse the arguments order */
args[nrofargs - i - 1] = (DWORD)MapSL(ptr);
DWORD arg = (DWORD)MapSL(ptr);
if (!HIWORD(arg))
arg = 0;
args[nrofargs - i - 1] = arg;
TRACE("%08x(%p),",ptr,MapSL(ptr));
}
else
Expand Down

0 comments on commit 50dcdb9

Please sign in to comment.