diff --git a/platform/src/ssl_stream.cpp b/platform/src/ssl_stream.cpp index 2ee5e55..67bd24d 100644 --- a/platform/src/ssl_stream.cpp +++ b/platform/src/ssl_stream.cpp @@ -796,7 +796,8 @@ static SSL * upstream_ssl_create(struct ssl_mgr * mgr, const struct ssl_chello * } if (chello->alpn) { - SSL_set_alpn_protos(ssl, chello->alpn, strlen(chello->alpn)); + ret=SSL_set_alpn_protos(ssl, (unsigned char*)chello->alpn, strlen(chello->alpn)); + assert(0); } /* lower memory footprint for idle connections */ SSL_set_mode(ssl, SSL_get_mode(ssl) | SSL_MODE_RELEASE_BUFFERS); diff --git a/platform/src/ssl_utils.cc b/platform/src/ssl_utils.cc index 11fa6bf..5a7deb8 100644 --- a/platform/src/ssl_utils.cc +++ b/platform/src/ssl_utils.cc @@ -1840,8 +1840,8 @@ static char* parse_alpn_extension(const unsigned char* buff, size_t buff_len, en *result = CHELLO_PARSE_INVALID_FORMAT; return NULL; } - char* alpn = (char*)malloc(len + 1); - strncpy(alpn, (const char*)buff + 2, len); + char* alpn = ALLOC(char, len + 1); + strncpy((char*)alpn, (const char*)buff + 2, len); alpn[len] = '\0'; *result = CHELLO_PARSE_SUCCESS; return alpn; diff --git a/platform/test/test_chello_parse.cpp b/platform/test/test_chello_parse.cpp index 56fdb8d..7a45add 100644 --- a/platform/test/test_chello_parse.cpp +++ b/platform/test/test_chello_parse.cpp @@ -147,7 +147,7 @@ int main() printf("cipher suites: %s\n", chello2->cipher_suites); printf("cipher suites for tls1.3: %s\n", chello2->cipher_suites_tls13); printf("sni: %s\n", chello2->sni); - char* alpn = parse_alpn(chello2->alpn); + char* alpn = parse_alpn((char*)chello2->alpn); printf("alpn: %s\n", alpn); free(alpn); alpn = NULL;