summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-22 05:14:42 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-22 05:14:42 +0000
commit95985829574c638cf169e611ff76749602353a50 (patch)
tree9adf23038fc9d73142f0a44b05d2c87b3f36c89d /lib
parent669e9ac5ff2593b175bd6b0b30d482d3e2fbced3 (diff)
merge revision(s) 44884: [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_1@45109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/resolv.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb
index 0c2b68ec27..ed12764a1b 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -1520,6 +1520,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
@@ -1547,6 +1548,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]
@@ -1570,6 +1572,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