Commit c0e49c5c authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ws2_32: Simplify some address calculations for SIO_ADDRESS_LIST_QUERY.

parent 32724def
......@@ -3963,9 +3963,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
for (p = table, num = 0; p; p = p->Next)
if (p->IpAddressList.IpAddress.String[0]) num++;
total = sizeof(SOCKET_ADDRESS_LIST) + sizeof(SOCKET_ADDRESS) * (num - 1);
total += sizeof(SOCKADDR) * num;
total = FIELD_OFFSET(SOCKET_ADDRESS_LIST, Address[num]) + num * sizeof(*sockaddr);
if (total > out_size || !out_buff)
{
*ret_size = total;
......@@ -3976,7 +3974,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
sa_list = out_buff;
sa = sa_list->Address;
sockaddr = (SOCKADDR_IN *)((char *)sa + num * sizeof(SOCKET_ADDRESS));
sockaddr = (SOCKADDR_IN *)&sa[num];
sa_list->iAddressCount = num;
for (p = table, i = 0; p; p = p->Next)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment