ws2_32: Fix hostent memory allocation

Bruno Jesus 00cpxxx at gmail.com
Sat Apr 14 14:16:25 CDT 2012


Currently WS_create_he is used in 2 different places with incompatible
arguments. The first call assumes that the parameters are the number
of items (aliases/addresses) [1] the second call assumes the
parameters are the required amount of bytes to alloc [2]. The second
call is clearly wrong because WS_create_he multiply the parameters by
sizeof(char*) so the current approach allocates way more memory than
required when gethostbyname is called. This patch normalizes
WS_create_he making it more flexible and allowing the correct
allocation of memory. It also make list_dup and list_size more
flexible so they can be used in different ways allowing to get
separate amount of data and item count in list_size and allowing
list_dup to start copying items from a different point.

Fixes bug 3962.

[1] = http://source.winehq.org/source/dlls/ws2_32/socket.c#L4559
[2] = http://source.winehq.org/source/dlls/ws2_32/socket.c#L5644

-- 
universe* god::bigbang (void); //and then it all began...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ws2_32-fix-hostent-allocation.patch
Type: application/octet-stream
Size: 11231 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20120414/9f7f6eb9/attachment.obj>


More information about the wine-patches mailing list