[PATCH] wininet: NULL-terminate url string passed to InternetCrackUrlW from InternetCrackUrlA

Nigel Liang ncliang at gmail.com
Thu Oct 4 21:51:09 CDT 2007


Changelog:
  Add NULL-termination to url passed into InternetCrackUrlW from InternetCrackUrlA
---
 dlls/wininet/internet.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 0edca74..96c1c71 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -1083,8 +1083,9 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lps
        InternetCrackUrlW should not include it                  */
   if (dwUrlLength == -1) nLength--;
 
-  lpwszUrl=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WCHAR)*nLength);
-  MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,nLength);
+  lpwszUrl=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WCHAR)*(nLength+1));
+  MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,(nLength+1));
+  lpwszUrl[nLength] = 0;
 
   memset(&UCW,0,sizeof(UCW));
   if(lpUrlComponents->dwHostNameLength!=0)
-- 
1.4.1




More information about the wine-patches mailing list