[dlls/shlwapi/path.c] Elimination of strncpy + bug.

Peter Berg Larsen pebl at math.ku.dk
Fri Apr 15 17:28:39 CDT 2005


Given that PathCompactPathA if lpszPath == null return false, I believe
PathCompactPathW should do the same (first hunk, bRet is initialized to
TRUE).

Changelog:
        Eliminate strncpy. Return false if null parameter.


Index: dlls/shlwapi/path.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/path.c,v
retrieving revision 1.52
diff -u -r1.52 path.c
--- dlls/shlwapi/path.c 28 Mar 2005 14:58:52 -0000      1.52
+++ dlls/shlwapi/path.c 15 Apr 2005 20:14:50 -0000
@@ -2774,7 +2774,7 @@
  *  dx       [I]   Desired width
  *
  * RETURNS
- *  TRUE  If the path was modified.
+ *  TRUE  If the path was modified/went well.
  *  FALSE Otherwise.
  */
 BOOL WINAPI PathCompactPathA(HDC hDC, LPSTR lpszPath, UINT dx)
@@ -2810,7 +2810,7 @@
   TRACE("(%p,%s,%d)\n", hDC, debugstr_w(lpszPath), dx);

   if (!lpszPath)
-    return bRet;
+    return FALSE;

   if (!hDC)
     hdc = hDC = GetDC(0);
@@ -2887,7 +2887,7 @@

     if (dwLen > MAX_PATH - 3)
       dwLen =  MAX_PATH - 3;
-    strncpyW(buff, sFile, dwLen);
+    lstrcpynW(buff, sFile, dwLen);

     do {
       dwLen--;




More information about the wine-patches mailing list