mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 01:54:00 +02:00
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
This commit is contained in:
parent
f9acab1f42
commit
d9e36580ef
3 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue