Module: wine Branch: master Commit: be59e2bb5396ac40568e999c3ccd6a609db97e00 URL: http://source.winehq.org/git/wine.git/?a=commit;h=be59e2bb5396ac40568e999c3c...
Author: Alexandre Julliard julliard@winehq.org Date: Tue May 22 11:59:36 2007 +0200
Fix a couple of overflowing heap allocations revealed by the previous change.
---
dlls/ntdll/file.c | 5 +++-- dlls/wininet/internet.c | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 4936bb2..3265ed5 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -1449,9 +1449,10 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, SERVER_END_REQ; if (!io->u.Status) { + char *tmpbuf; ULONG size = info->MaximumMessageSize ? info->MaximumMessageSize : 0x10000; - char *tmpbuf = RtlAllocateHeap( GetProcessHeap(), 0, size ); - if (tmpbuf) + if (size > 0x10000) size = 0x10000; + if ((tmpbuf = RtlAllocateHeap( GetProcessHeap(), 0, size ))) { int fd, needs_close; if (!server_get_unix_fd( hFile, FILE_READ_DATA, &fd, &needs_close, NULL, NULL )) diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 3bfa62f..b507312 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1044,6 +1044,13 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, WCHAR* lpwszUrl;
TRACE("(%s %u %x %p)\n", debugstr_a(lpszUrl), dwUrlLength, dwFlags, lpUrlComponents); + + if (!lpszUrl || !*lpszUrl) + { + INTERNET_SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + if(dwUrlLength<=0) dwUrlLength=-1; nLength=MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,NULL,0);