Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions ext/openssl/ossl_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2482,16 +2482,15 @@ ossl_ssl_get_verify_result(VALUE self)

/*
* call-seq:
* ssl.finished_message => "finished message"
*
* Returns the last *Finished* message sent
* ssl.finished_message -> string or nil
*
* Returns the contents of the last +Finished+ message sent to the peer.
*/
static VALUE
ossl_ssl_get_finished(VALUE self)
{
SSL *ssl;
char sizer[1], *buf;
char sizer[1];
size_t len;

GetSSL(self, ssl);
Expand All @@ -2500,23 +2499,23 @@ ossl_ssl_get_finished(VALUE self)
if (len == 0)
return Qnil;

buf = ALLOCA_N(char, len);
SSL_get_finished(ssl, buf, len);
return rb_str_new(buf, len);
VALUE str = rb_str_new(NULL, len);
SSL_get_finished(ssl, RSTRING_PTR(str), len);
return str;
}

/*
* call-seq:
* ssl.peer_finished_message => "peer finished message"
*
* Returns the last *Finished* message received
* ssl.peer_finished_message -> string or nil
*
* Returns the contents of the last +Finished+ message expected to be sent
* by the peer.
*/
static VALUE
ossl_ssl_get_peer_finished(VALUE self)
{
SSL *ssl;
char sizer[1], *buf;
char sizer[1];
size_t len;

GetSSL(self, ssl);
Expand All @@ -2525,9 +2524,9 @@ ossl_ssl_get_peer_finished(VALUE self)
if (len == 0)
return Qnil;

buf = ALLOCA_N(char, len);
SSL_get_peer_finished(ssl, buf, len);
return rb_str_new(buf, len);
VALUE str = rb_str_new(NULL, len);
SSL_get_peer_finished(ssl, RSTRING_PTR(str), len);
return str;
}

/*
Expand Down