[dlls/gdi/env.c] Strncpy elimination.

Peter Berg Larsen pebl at math.ku.dk
Sun Mar 27 11:58:19 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/gdi/env.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/env.c,v
retrieving revision 1.1
diff -u -r1.1 env.c
--- dlls/gdi/env.c	12 Feb 2004 02:17:51 -0000	1.1
+++ dlls/gdi/env.c	26 Mar 2005 09:40:30 -0000
@@ -67,8 +67,7 @@
 {
     char buffer[256];

-    strncpy( buffer, lpPortName, sizeof(buffer) );
-    buffer[sizeof(buffer)-1] = 0;
+    lstrcpynA( buffer, lpPortName, sizeof(buffer) );

     if (buffer[0] && buffer[strlen(buffer)-1] == ':') buffer[strlen(buffer)-1] = 0;






More information about the wine-patches mailing list