* ext/openssl/ossl_ssl.c (ssl_npn_select_cb_common): fix parsing
protocol list. The protocol list from OpenSSL is not null-terminated. patched by Kazuki Yamaguchi [Bug #11810] [ruby-core:72082] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
13d8bb0385
commit
1dd1a9873e
@ -1,3 +1,10 @@
|
|||||||
|
Sun Dec 13 10:26:47 2015 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/openssl/ossl_ssl.c (ssl_npn_select_cb_common): fix parsing
|
||||||
|
protocol list.
|
||||||
|
The protocol list from OpenSSL is not null-terminated.
|
||||||
|
patched by Kazuki Yamaguchi [Bug #11810] [ruby-core:72082]
|
||||||
|
|
||||||
Sun Dec 13 06:40:30 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
Sun Dec 13 06:40:30 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||||
|
|
||||||
* lib/ostruct.rb: Have OpenStruct#dig raise if argument is not a
|
* lib/ostruct.rb: Have OpenStruct#dig raise if argument is not a
|
||||||
|
@ -585,19 +585,16 @@ ssl_npn_select_cb_common(VALUE cb, const unsigned char **out, unsigned char *out
|
|||||||
{
|
{
|
||||||
VALUE selected;
|
VALUE selected;
|
||||||
long len;
|
long len;
|
||||||
unsigned char l;
|
|
||||||
VALUE protocols = rb_ary_new();
|
VALUE protocols = rb_ary_new();
|
||||||
|
unsigned char l;
|
||||||
|
const unsigned char *in_end = in + inlen;
|
||||||
|
|
||||||
/* The format is len_1|proto_1|...|len_n|proto_n\0 */
|
/* assume OpenSSL verifies this format */
|
||||||
while ((l = *in++) != '\0') {
|
/* The format is len_1|proto_1|...|len_n|proto_n */
|
||||||
VALUE protocol;
|
while (in < in_end) {
|
||||||
if (l > inlen) {
|
l = *in++;
|
||||||
ossl_raise(eSSLError, "Invalid protocol name list");
|
rb_ary_push(protocols, rb_str_new((const char *)in, l));
|
||||||
}
|
|
||||||
protocol = rb_str_new((const char *)in, l);
|
|
||||||
rb_ary_push(protocols, protocol);
|
|
||||||
in += l;
|
in += l;
|
||||||
inlen -= l;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selected = rb_funcall(cb, rb_intern("call"), 1, protocols);
|
selected = rb_funcall(cb, rb_intern("call"), 1, protocols);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user