shell32: fix compilation error with strcpy_chk: buffer overflow detected

Vitaly Lipatov lav at etersoft.ru
Sat Jun 2 03:42:10 CDT 2012


---
  dlls/shell32/pidl.c |    5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c
index c394e5b..5906a4f 100644
--- a/dlls/shell32/pidl.c
+++ b/dlls/shell32/pidl.c
@@ -1752,16 +1752,17 @@ LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew)
  LPITEMIDLIST _ILCreateEntireNetwork(void)
  {
      LPITEMIDLIST pidlOut;
+    DWORD alen = sizeof("Entire Network");

      TRACE("\n");

-    pidlOut = _ILAlloc(PT_NETWORK, FIELD_OFFSET(PIDLDATA, 
u.network.szNames[sizeof("Entire Network")]));
+    pidlOut = _ILAlloc(PT_NETWORK, FIELD_OFFSET(PIDLDATA, 
u.network.szNames[alen]));
      if (pidlOut)
      {
          LPPIDLDATA pData = _ILGetDataPointer(pidlOut);

          pData->u.network.dummy = 0;
-        strcpy(pData->u.network.szNames, "Entire Network");
+        memcpy(pData->u.network.szNames, "Entire Network", alen + 1);
      }
      return pidlOut;
  }
-- 
1.7.9.7

-- 
С уважением,
Виталий Липатов,
Etersoft



More information about the wine-patches mailing list