[dlls/msvideo/msvideo.16.c] Strncpy elimination.

Peter Berg Larsen pebl at math.ku.dk
Sun Mar 27 12:04:23 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/msvideo/msvideo16.c
===================================================================
RCS file: /home/wine/wine/dlls/msvideo/msvideo16.c,v
retrieving revision 1.12
diff -u -r1.12 msvideo16.c
--- dlls/msvideo/msvideo16.c	29 Jun 2004 04:21:08 -0000	1.12
+++ dlls/msvideo/msvideo16.c	26 Mar 2005 09:40:53 -0000
@@ -821,17 +821,15 @@
     infobuf = HeapAlloc(GetProcessHeap(), 0, infosize);
     if (GetFileVersionInfoA(fn, verhandle, infosize, infobuf))
     {
-        char	vbuf[200];
         /* Yes, two space behind : */
         /* FIXME: test for buflen */
-        sprintf(vbuf, "Version:  %d.%d.%d.%d\n",
+        snprintf(buf2, buf2len, "Version:  %d.%d.%d.%d\n",
                 ((WORD*)infobuf)[0x0f],
                 ((WORD*)infobuf)[0x0e],
                 ((WORD*)infobuf)[0x11],
                 ((WORD*)infobuf)[0x10]
 	    );
-        TRACE("version of %s is %s\n", fn, vbuf);
-        strncpy(buf2, vbuf, buf2len);
+        TRACE("version of %s is %s\n", fn, buf2);
     }
     else
     {





More information about the wine-patches mailing list