net.http: fix crash on Windows when using Boehm GC (#14351)

Isaiah 2022-05-10 07:00:55 -04:00 committed by Jef Roosens
parent 1c7cd95664
commit 71af8abb43
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
3 changed files with 9 additions and 1 deletions

View File

@ -877,7 +877,7 @@ static SECURITY_STATUS https_make_request(TlsContext *tls_ctx, CHAR *req, CHAR *
// increase buffer size if we need
int required_length = *length+(int)pDataBuffer->cbBuffer;
if( required_length > buff_size ) {
CHAR *a = realloc(*out, required_length);
CHAR *a = VSCHANNEL_REALLOC(*out, required_length);
if( a == NULL ) {
scRet = SEC_E_INTERNAL_ERROR;
return scRet;

View File

@ -20,6 +20,10 @@
// Define here to be sure
#define SP_PROT_TLS1_2_CLIENT 0x00000800
#if !defined(VSCHANNEL_REALLOC)
#define VSCHANNEL_REALLOC realloc
#endif
typedef struct TlsContext TlsContext;
TlsContext new_tls_context();

View File

@ -3,6 +3,10 @@
// that can be found in the LICENSE file.
module http
$if gcboehm ? {
#define VSCHANNEL_REALLOC GC_REALLOC
}
#flag windows -I @VEXEROOT/thirdparty/vschannel
#flag -l ws2_32 -l crypt32 -l secur32 -l user32
#include "vschannel.c"