Exception: Msf::BadcharError
- Inherits:
-
EncodingError
- Object
- RuntimeError
- EncodingError
- Msf::BadcharError
- Defined in:
- lib/msf/core/exception.rb
Overview
Thrown when an encoder fails to encode a buffer due to a bad character.
Instance Attribute Summary collapse
-
#buf ⇒ Object
readonly
Returns the value of attribute buf.
-
#char ⇒ Object
readonly
Returns the value of attribute char.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#stub_size ⇒ Object
readonly
Returns the value of attribute stub_size.
Instance Method Summary collapse
-
#initialize(buf = nil, index = nil, stub_size = nil, char = nil) ⇒ BadcharError
constructor
A new instance of BadcharError.
- #to_s ⇒ Object
Constructor Details
#initialize(buf = nil, index = nil, stub_size = nil, char = nil) ⇒ BadcharError
Returns a new instance of BadcharError.
106 107 108 109 110 111 |
# File 'lib/msf/core/exception.rb', line 106 def initialize(buf = nil, index = nil, stub_size = nil, char = nil) @buf = buf @index = index @stub_size = stub_size @char = char end |
Instance Attribute Details
#buf ⇒ Object (readonly)
Returns the value of attribute buf.
128 129 130 |
# File 'lib/msf/core/exception.rb', line 128 def buf @buf end |
#char ⇒ Object (readonly)
Returns the value of attribute char.
128 129 130 |
# File 'lib/msf/core/exception.rb', line 128 def char @char end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
128 129 130 |
# File 'lib/msf/core/exception.rb', line 128 def index @index end |
#stub_size ⇒ Object (readonly)
Returns the value of attribute stub_size.
128 129 130 |
# File 'lib/msf/core/exception.rb', line 128 def stub_size @stub_size end |
Instance Method Details
#to_s ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/msf/core/exception.rb', line 113 def to_s # Deal with elements of a String being an instance of String instead of # Integer in ruby 1.9. if (char.respond_to? :ord) c = char.ord else c = char end if (c) return "Encoding failed due to a bad character (index=#{index}, char=#{sprintf("0x%.2x", c)})" else return "Encoding failed due to a nil character" end end |