redns 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/redns/buffer.rb +2 -2
- data/redns.gemspec +1 -1
- data/test/test_redns_buffer.rb +1 -8
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/redns/buffer.rb
CHANGED
@@ -40,7 +40,7 @@ class ReDNS::Buffer < String
|
|
40
40
|
def unpack(format)
|
41
41
|
return [ ] if (@size <= 0)
|
42
42
|
|
43
|
-
|
43
|
+
return if (@offset > total_length)
|
44
44
|
|
45
45
|
data = to_s.unpack(format)
|
46
46
|
advance(data.pack(format).length)
|
@@ -52,7 +52,7 @@ class ReDNS::Buffer < String
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def read(chars = 1)
|
55
|
-
|
55
|
+
return if (@offset + chars > total_length)
|
56
56
|
|
57
57
|
result = to_str[@offset, chars]
|
58
58
|
advance(chars)
|
data/redns.gemspec
CHANGED
data/test/test_redns_buffer.rb
CHANGED
@@ -11,14 +11,7 @@ class TestReDNSBuffer < Test::Unit::TestCase
|
|
11
11
|
assert buffer.empty?
|
12
12
|
assert !buffer.inspect.empty?
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
begin
|
17
|
-
assert '', buffer.read
|
18
|
-
rescue Object => rescued
|
19
|
-
end
|
20
|
-
|
21
|
-
assert_equal ReDNS::Exception::BufferUnderrun, rescued.class
|
14
|
+
assert_equal nil, buffer.read
|
22
15
|
end
|
23
16
|
|
24
17
|
def test_simple_duplicate
|