ws2_32: ws_sockaddr_u2ws should zero the WS_sockaddr before using it.

Francois Gouget fgouget at free.fr
Wed Dec 20 06:37:22 CST 2006


On Wed, 20 Dec 2006, Kai Blin wrote:

@@ -946,6 +946,9 @@ static int ws_sockaddr_u2ws(const struct
 {
     int res;
 
+    /* Zero the ws_sockaddr structure before using */
+    memset(wsaddr, 0, *wsaddrlen);

Are you sure this is needed in ws_sockaddr_u2ws() or should it rather be 
done by getsockname() (as your test indicates). Also, do we know of a 
real-world application that needs this?

Finally, this memset() makes the one in the AF_UNSPEC case redundant, 
and may itself be redundant with some of the memcpy()s...

-- 
Francois Gouget <fgouget at free.fr>              http://fgouget.free.fr/
                         Stolen from an Internet user:
              "f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng !"



More information about the wine-devel mailing list