From d9e36580efff79a791ac7122fc4b83b171e53cde Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 15 Feb 2014 14:59:17 +0000 Subject: merge revision(s) r44884: [Backport #9498] * lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise DecodeError if no data before the limit. Reported by Will Bryant. [ruby-core:60557] [Bug #9498] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ lib/resolv.rb | 3 +++ version.h | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4a120205cc..1478e68184 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Feb 15 23:58:31 2014 Tanaka Akira + + * lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise + DecodeError if no data before the limit. + Reported by Will Bryant. [ruby-core:60557] [Bug #9498] + Sat Feb 15 23:46:31 2014 Nobuyoshi Nakada * parse.y (IDSET_ATTRSET_FOR_INTERN): fix off-by-one bug. diff --git a/lib/resolv.rb b/lib/resolv.rb index f7232c18ff..4214465516 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -1489,6 +1489,7 @@ class Resolv end def get_bytes(len = @limit - @index) + raise DecodeError.new("limit exceeded") if @limit < @index + len d = @data[@index, len] @index += len return d @@ -1516,6 +1517,7 @@ class Resolv end def get_string + raise DecodeError.new("limit exceeded") if @limit <= @index len = @data[@index].ord raise DecodeError.new("limit exceeded") if @limit < @index + 1 + len d = @data[@index + 1, len] @@ -1539,6 +1541,7 @@ class Resolv limit = @index if !limit || @index < limit d = [] while true + raise DecodeError.new("limit exceeded") if @limit <= @index case @data[@index].ord when 0 @index += 1 diff --git a/version.h b/version.h index 159c12e06b..010579c880 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2014-02-15" -#define RUBY_PATCHLEVEL 410 +#define RUBY_PATCHLEVEL 411 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 2 -- cgit v1.2.3