long cw_num=count,cr_num=count;
long sw_num=count,sr_num=count;
int ret=1;
long cw_num=count,cr_num=count;
long sw_num=count,sr_num=count;
int ret=1;
- memset(cbuf,0,sizeof(cbuf));
- memset(sbuf,0,sizeof(sbuf));
+ bufsiz = count>40*1024 ? 40*1024 : count;
+
+ if ((cbuf = OPENSSL_malloc(bufsiz))==NULL) goto err;
+ if ((sbuf = OPENSSL_malloc(bufsiz))==NULL) goto err;
+
+ memset(cbuf,0,bufsiz);
+ memset(sbuf,0,bufsiz);
SSL_set_connect_state(c_ssl);
SSL_set_bio(c_ssl,s_to_c,c_to_s);
SSL_set_connect_state(c_ssl);
SSL_set_bio(c_ssl,s_to_c,c_to_s);
BIO_set_ssl(c_bio,c_ssl,BIO_NOCLOSE);
SSL_set_accept_state(s_ssl);
SSL_set_bio(s_ssl,c_to_s,s_to_c);
BIO_set_ssl(c_bio,c_ssl,BIO_NOCLOSE);
SSL_set_accept_state(s_ssl);
SSL_set_bio(s_ssl,c_to_s,s_to_c);
if (s_to_c != NULL) BIO_free(s_to_c);
if (c_bio != NULL) BIO_free_all(c_bio);
if (s_bio != NULL) BIO_free_all(s_bio);
if (s_to_c != NULL) BIO_free(s_to_c);
if (c_bio != NULL) BIO_free_all(c_bio);
if (s_bio != NULL) BIO_free_all(s_bio);