From bf8237553c81b61a935ad10d42ca4ab99ce34412 Mon Sep 17 00:00:00 2001 From: Sergei Turchanov Date: Wed, 12 Feb 2003 21:29:20 +0000 Subject: [PATCH] - _SHStrDupAA forgot about terminating '\0'. - SHStrDupA adds extra terminator which is not needed as the length returned by MultiByteToWideChar(,,-1,,) already includes it. --- dlls/shlwapi/string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c index bfda868b59c..c928443bc67 100644 --- a/dlls/shlwapi/string.c +++ b/dlls/shlwapi/string.c @@ -1716,7 +1716,7 @@ static HRESULT WINAPI _SHStrDupAA(LPCSTR src, LPSTR * dest) int len = 0; if (src) { - len = lstrlenA(src); + len = lstrlenA(src) + 1; *dest = CoTaskMemAlloc(len); } else { *dest = NULL; @@ -1753,7 +1753,7 @@ HRESULT WINAPI SHStrDupA(LPCSTR src, LPWSTR * dest) int len = 0; if (src) { - len = (MultiByteToWideChar(0,0,src,-1,0,0) + 1)* sizeof(WCHAR); + len = MultiByteToWideChar(0,0,src,-1,0,0) * sizeof(WCHAR); *dest = CoTaskMemAlloc(len); } else { *dest = NULL;