[dlls/winsock/socket.c] Strncpy elimination.

Peter Berg Larsen pebl at math.ku.dk
Sun Mar 27 12:20:04 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/winsock/socket.c
===================================================================
RCS file: /home/wine/wine/dlls/winsock/socket.c,v
retrieving revision 1.175
diff -u -r1.175 socket.c
--- dlls/winsock/socket.c	24 Mar 2005 21:01:35 -0000	1.175
+++ dlls/winsock/socket.c	26 Mar 2005 09:41:48 -0000
@@ -1959,8 +1959,7 @@
                         struct ifreq ifInfo;

                         /* Socket Status Flags */
-                        strncpy(ifInfo.ifr_name, ptr->AdapterName, IFNAMSIZ);
-                        ifInfo.ifr_name[IFNAMSIZ-1] = '\0';
+                        lstrcpynA(ifInfo.ifr_name, ptr->AdapterName, IFNAMSIZ);
                         if (ioctl(fd, SIOCGIFFLAGS, &ifInfo) < 0)
                         {
                            ERR("Error obtaining status flags for socket!\n");





More information about the wine-patches mailing list