- _SHStrDupAA forgot about terminating '\0'.
- SHStrDupA adds extra terminator which is not needed as the length returned by MultiByteToWideChar(,,-1,,) already includes it.
This commit is contained in:
parent
5e71f2d536
commit
bf8237553c
|
@ -1716,7 +1716,7 @@ static HRESULT WINAPI _SHStrDupAA(LPCSTR src, LPSTR * dest)
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
if (src) {
|
if (src) {
|
||||||
len = lstrlenA(src);
|
len = lstrlenA(src) + 1;
|
||||||
*dest = CoTaskMemAlloc(len);
|
*dest = CoTaskMemAlloc(len);
|
||||||
} else {
|
} else {
|
||||||
*dest = NULL;
|
*dest = NULL;
|
||||||
|
@ -1753,7 +1753,7 @@ HRESULT WINAPI SHStrDupA(LPCSTR src, LPWSTR * dest)
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
if (src) {
|
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);
|
*dest = CoTaskMemAlloc(len);
|
||||||
} else {
|
} else {
|
||||||
*dest = NULL;
|
*dest = NULL;
|
||||||
|
|
Loading…
Reference in New Issue