summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-14 06:55:15 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-14 06:55:15 +0000
commitd4fa125941edd2a4697ad4854536dbc23fd38a16 (patch)
tree00c776593f182b5c836d878a613e57624ae613d5 /lib
parent681d225d26704637cffb241fb8c88a76209d8798 (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_1_9_3@44948 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 646a36b36f..643532b905 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -1457,6 +1457,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
@@ -1484,6 +1485,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]
@@ -1507,6 +1509,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