summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 13:54:02 +0000
committerngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 13:54:02 +0000
commit36c40166aca9dd59dc867ac2e46f102cc443c4b2 (patch)
treec1892136bec1a074d519c4fc5803258009fab368 /ext
parent40a442541cfe836cdff88dbc385bb87110d71ae9 (diff)
* ext/openssl/ossl_ssl.c (ssl_npn_encode_protocol_i): fix byte order
issue on big-endian architecture [ruby-core:50292] [Bug #7463] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/ossl_ssl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index 34df7d3d01a..d5c07d79a99 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -569,10 +569,12 @@ static VALUE
ssl_npn_encode_protocol_i(VALUE cur, VALUE encoded)
{
int len = RSTRING_LENINT(cur);
+ char len_byte;
if (len < 1 || len > 255)
ossl_raise(eSSLError, "Advertised protocol must have length 1..255");
/* Encode the length byte */
- rb_str_buf_cat(encoded, (const char *) &len, 1);
+ len_byte = len;
+ rb_str_buf_cat(encoded, &len_byte, 1);
rb_str_buf_cat(encoded, RSTRING_PTR(cur), len);
return Qnil;
}