[WS2_32] - Use size of struct instead of size of pointer. Don't copy szProtocol, because it's set later. CID 14129 and 54.

svn path=/trunk/; revision=54615
This commit is contained in:
Rafal Harabien 2011-12-08 19:21:01 +00:00
parent 5eb7f4cb10
commit 1805dc67b0

View file

@ -401,7 +401,7 @@ WSAStringToAddressA(IN LPSTR AddressString,
memcpy(lpProtoInfoW, memcpy(lpProtoInfoW,
lpProtocolInfo, lpProtocolInfo,
sizeof(LPWSAPROTOCOL_INFOA)); FIELD_OFFSET(WSAPROTOCOL_INFOA, szProtocol));
MultiByteToWideChar(CP_ACP, MultiByteToWideChar(CP_ACP,
0, 0,
@ -460,8 +460,8 @@ WSAStringToAddressW(IN LPWSTR AddressString,
/* Set right adress family */ /* Set right adress family */
if (lpProtocolInfo!=NULL) if (lpProtocolInfo!=NULL)
sockaddr->sin_family = lpProtocolInfo->iAddressFamily; sockaddr->sin_family = lpProtocolInfo->iAddressFamily;
else
else sockaddr->sin_family = AddressFamily; sockaddr->sin_family = AddressFamily;
/* Report size */ /* Report size */
if (AddressFamily == AF_INET) if (AddressFamily == AF_INET)
@ -923,14 +923,13 @@ gethostbyname(IN CONST CHAR FAR* name)
if(name == NULL) if(name == NULL)
{ {
ret = gethostname(p->Hostent->h_name, MAX_HOSTNAME_LEN); ret = gethostname(p->Hostent->h_name, MAX_HOSTNAME_LEN);
return p->Hostent;
}
if(ret) if(ret)
{ {
WSASetLastError( WSAHOST_NOT_FOUND ); //WSANO_DATA ?? WSASetLastError( WSAHOST_NOT_FOUND ); //WSANO_DATA ??
return NULL; return NULL;
} }
return p->Hostent;
}
/* Is it an IPv6 address? */ /* Is it an IPv6 address? */
found = strstr(name, ":"); found = strstr(name, ":");