[dlls/setupapi/setupcab.c] Strncpy elimination.

Peter Berg Larsen pebl at math.ku.dk
Sun Mar 27 12:11:53 CST 2005


I have been checking the usage of strncpy, replacing where apropriate with
a memcpy or lstrcpyn[AW]. The first raw diff was 100kb, so there is bound
to be one or two slips. These are the first batch which I found to be
obvious, correct, and didnt need a special comment. Note with correct I
mean if there was a \0 bug before then it still there.

Changelog:
	Janitorial Task: Check the usage of strncpy/strncpyW.

Index: dlls/setupapi/setupcab.c
===================================================================
RCS file: /home/wine/wine/dlls/setupapi/setupcab.c,v
retrieving revision 1.9
diff -u -r1.9 setupcab.c
--- dlls/setupapi/setupcab.c	3 Feb 2005 13:34:50 -0000	1.9
+++ dlls/setupapi/setupcab.c	26 Mar 2005 09:41:11 -0000
@@ -363,9 +363,7 @@
     } else {
       if (mysterio[0]) {
         /* some easy paranoia.  no such carefulness exists on the wide API IIRC */
-        mysterio[SIZEOF_MYSTERIO - 1] = '\0';
-        strncpy(pfdin->psz3, &(mysterio[0]), 255);
-        mysterio[255] = '\0';
+        lstrcpynA(pfdin->psz3, &(mysterio[0]), SIZEOF_MYSTERIO);
       }
       return 0;
     }





More information about the wine-patches mailing list