Lei Zhang : shlwapi: Check more arguments to UrlEscapeA.
Alexandre Julliard
julliard at winehq.org
Thu Jan 10 06:42:01 CST 2008
Module: wine
Branch: master
Commit: 43bff70a22e90a9b210d048e087f9435b243f7bf
URL: http://source.winehq.org/git/wine.git/?a=commit;h=43bff70a22e90a9b210d048e087f9435b243f7bf
Author: Lei Zhang <thestig at google.com>
Date: Wed Jan 9 13:50:34 2008 -0800
shlwapi: Check more arguments to UrlEscapeA.
---
dlls/shlwapi/tests/url.c | 12 +++---------
dlls/shlwapi/url.c | 4 ++--
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index 3506075..b7549bd 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -461,23 +461,17 @@ static void test_UrlEscape(void)
ret = UrlEscapeA("/woningplan/woonkamer basis.swf", NULL, &size, URL_ESCAPE_SPACES_ONLY);
ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
- todo_wine {
- ok(size == 0, "got %d, expected %d\n", size, 0);
- }
+ ok(size == 0, "got %d, expected %d\n", size, 0);
size = 0;
ret = UrlEscapeA("/woningplan/woonkamer basis.swf", empty_string, &size, URL_ESCAPE_SPACES_ONLY);
ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
- todo_wine {
- ok(size == 0, "got %d, expected %d\n", size, 0);
- }
+ ok(size == 0, "got %d, expected %d\n", size, 0);
size = 1;
ret = UrlEscapeA("/woningplan/woonkamer basis.swf", NULL, &size, URL_ESCAPE_SPACES_ONLY);
ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
- todo_wine {
- ok(size == 1, "got %d, expected %d\n", size, 1);
- }
+ ok(size == 1, "got %d, expected %d\n", size, 1);
size = 1;
ret = UrlEscapeA("/woningplan/woonkamer basis.swf", empty_string, NULL, URL_ESCAPE_SPACES_ONLY);
diff --git a/dlls/shlwapi/url.c b/dlls/shlwapi/url.c
index 5480357..ac150e6 100644
--- a/dlls/shlwapi/url.c
+++ b/dlls/shlwapi/url.c
@@ -843,7 +843,7 @@ HRESULT WINAPI UrlEscapeA(
HRESULT ret;
DWORD lenW = sizeof(bufW)/sizeof(WCHAR), lenA;
- if (!pcchEscaped)
+ if (!pszEscaped || !pcchEscaped || !*pcchEscaped)
return E_INVALIDARG;
if(!RtlCreateUnicodeStringFromAsciiz(&urlW, pszUrl))
@@ -854,7 +854,7 @@ HRESULT WINAPI UrlEscapeA(
}
if(ret == S_OK) {
RtlUnicodeToMultiByteSize(&lenA, escapedW, lenW * sizeof(WCHAR));
- if(pszEscaped && *pcchEscaped > lenA) {
+ if(*pcchEscaped > lenA) {
RtlUnicodeToMultiByteN(pszEscaped, *pcchEscaped - 1, &lenA, escapedW, lenW * sizeof(WCHAR));
pszEscaped[lenA] = 0;
*pcchEscaped = lenA;
More information about the wine-cvs
mailing list