[dlls/wineps/afm2c.c] Strncpy elimination.

Peter Berg Larsen pebl at math.ku.dk
Sun Mar 27 12:17:46 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/wineps/afm2c.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/afm2c.c,v
retrieving revision 1.4
diff -u -r1.4 afm2c.c
--- dlls/wineps/afm2c.c	31 May 2002 23:40:54 -0000	1.4
+++ dlls/wineps/afm2c.c	26 Mar 2005 09:41:30 -0000
@@ -189,8 +189,7 @@
     FILE    *of;
     int     i;

-    strncpy(buffer, afm->FontName, sizeof(buffer) - 3);
-    buffer[sizeof(buffer) - 3] = '\0';
+    lstrcpynA(buffer, afm->FontName, sizeof(buffer) - 2);

     for (i = 0; i < strlen(buffer); ++i)
     	if (buffer[i] == '-')





More information about the wine-patches mailing list