Null-terminator fixes for SHLWAPI
Sergei Turchanov
plumber at print.vlad.ru
Thu Feb 6 11:00:22 CST 2003
1. _SHStrDupAA forgot about terminating '\0'.
2. SHStrDupA adds extra terminator which is not needed as
the length returned by MultiByteToWideChar(,,-1,,) already includes it.
Sergei Turchanov.
--- wine/dlls/shlwapi/string.c.old 2003-01-18 00:58:46.000000000 +0000
+++ wine/dlls/shlwapi/string.c 2003-02-07 01:51:50.000000000 +0000
@@ -1716,7 +1716,7 @@
int len = 0;
if (src) {
- len = lstrlenA(src);
+ len = lstrlenA(src) + 1;
*dest = CoTaskMemAlloc(len);
} else {
*dest = NULL;
@@ -1753,7 +1753,7 @@
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;
More information about the wine-patches
mailing list