1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

http/win: fix schannel from crashing

This commit is contained in:
joe-conigliaro 2019-10-09 09:59:23 +11:00 committed by Alexander Medvednikov
parent c620da9089
commit f570cbfca8

View File

@ -263,8 +263,8 @@ static INT connect_to_server(TlsContext *tls_ctx, LPWSTR host, INT port_number)
SOCKADDR_STORAGE local_address = { 0 }; SOCKADDR_STORAGE local_address = { 0 };
SOCKADDR_STORAGE remote_address = { 0 }; SOCKADDR_STORAGE remote_address = { 0 };
DWORD local_address_length; DWORD local_address_length = sizeof(local_address);
DWORD remote_address_length; DWORD remote_address_length = sizeof(remote_address);
struct timeval tv; struct timeval tv;
tv.tv_sec = 60; tv.tv_sec = 60;
@ -281,8 +281,8 @@ static INT connect_to_server(TlsContext *tls_ctx, LPWSTR host, INT port_number)
WCHAR service_name[10]; WCHAR service_name[10];
int res = wsprintf(service_name, L"%d", port_number); int res = wsprintf(service_name, L"%d", port_number);
if(WSAConnectByName(Socket,connect_name, service_name, local_address_length, if(WSAConnectByName(Socket,connect_name, service_name, &local_address_length,
&local_address, remote_address_length, &remote_address, &tv, NULL) == SOCKET_ERROR) { &local_address, &remote_address_length, &remote_address, &tv, NULL) == SOCKET_ERROR) {
wprintf(L"Error %d connecting to \"%s\" (%s)\n", wprintf(L"Error %d connecting to \"%s\" (%s)\n",
WSAGetLastError(), WSAGetLastError(),
connect_name, connect_name,
@ -930,7 +930,7 @@ static DWORD verify_server_certificate( PCCERT_CONTEXT pServerCert, LPWSTR host
CHAR *rgszUsages[] = { szOID_PKIX_KP_SERVER_AUTH, CHAR *rgszUsages[] = { szOID_PKIX_KP_SERVER_AUTH,
szOID_SERVER_GATED_CRYPTO, szOID_SERVER_GATED_CRYPTO,
szOID_SGC_NETSCAPE }; szOID_SGC_NETSCAPE };
DWORD cUsages = sizeof(rgszUsages) / sizeof(CHAR); DWORD cUsages = sizeof(rgszUsages) / sizeof(CHAR*);
PWSTR pwszServerName = NULL; PWSTR pwszServerName = NULL;
DWORD cchServerName; DWORD cchServerName;