Skip to content

Commit 30238f9

Browse files
committed
merge revision(s) 53064: [Backport #11810]
* 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/branches/ruby_2_2@56798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 3c61aab commit 30238f9

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Tue Nov 15 15:29:36 2016 NARUSE, Yui <naruse@ruby-lang.org>
2+
3+
* ext/openssl/ossl_ssl.c (ssl_npn_select_cb_common): fix parsing
4+
protocol list.
5+
The protocol list from OpenSSL is not null-terminated.
6+
patched by Kazuki Yamaguchi [Bug #11810] [ruby-core:72082]
7+
18
Tue Nov 15 03:55:45 2016 NARUSE, Yui <naruse@ruby-lang.org>
29

310
* ext/-test/file/fs.c (get_atime_p): Updating of file access times

ext/openssl/ossl_ssl.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -614,19 +614,16 @@ ssl_npn_select_cb_common(VALUE cb, const unsigned char **out, unsigned char *out
614614
{
615615
VALUE selected;
616616
long len;
617-
unsigned char l;
618617
VALUE protocols = rb_ary_new();
618+
unsigned char l;
619+
const unsigned char *in_end = in + inlen;
619620

620-
/* The format is len_1|proto_1|...|len_n|proto_n\0 */
621-
while (l = *in++) {
622-
VALUE protocol;
623-
if (l > inlen) {
624-
ossl_raise(eSSLError, "Invalid protocol name list");
625-
}
626-
protocol = rb_str_new((const char *)in, l);
627-
rb_ary_push(protocols, protocol);
621+
/* assume OpenSSL verifies this format */
622+
/* The format is len_1|proto_1|...|len_n|proto_n */
623+
while (in < in_end) {
624+
l = *in++;
625+
rb_ary_push(protocols, rb_str_new((const char *)in, l));
628626
in += l;
629-
inlen -= l;
630627
}
631628

632629
selected = rb_funcall(cb, rb_intern("call"), 1, protocols);

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.2.6"
22
#define RUBY_RELEASE_DATE "2016-11-15"
3-
#define RUBY_PATCHLEVEL 395
3+
#define RUBY_PATCHLEVEL 396
44

55
#define RUBY_RELEASE_YEAR 2016
66
#define RUBY_RELEASE_MONTH 11

0 commit comments

Comments
 (0)