mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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/trunk@44884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
61f50ae03e
commit
25a89ac0ac
2 changed files with 9 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
Sat Feb 8 15:27:02 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* 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 8 15:11:21 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* io.c (SMALLBUF): Unused macro removed.
|
||||
|
|
|
@ -1528,6 +1528,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
|
||||
|
@ -1555,6 +1556,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]
|
||||
|
@ -1578,6 +1580,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…
Reference in a new issue