1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 22:21:29 +00:00

Fixed a bunch of errors reported by Ron Bowes;

http://seclists.org/nmap-dev/2012/q2/639
This commit is contained in:
patrik
2012-06-06 21:57:00 +00:00
parent 731e8b5302
commit c4617f8d31
7 changed files with 85 additions and 19 deletions

View File

@@ -277,11 +277,12 @@ ASN1Decoder = {
--
ASN1Encoder = {
new = function(self,o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
new = function(self)
local o = {}
setmetatable(o, self)
self.__index = self
o:registerBaseEncoders()
return o
end,
---
@@ -332,6 +333,14 @@ ASN1Encoder = {
end
end
-- Table encoder
self.encoder['table'] = function( self, val )
assert('table' == type(val), "val is not a table")
assert(#val.type > 0, "Table is missing the type field")
assert(val.value ~= nil, "Table is missing the value field")
return bin.pack("HAA", val.type, self.encodeLength(#val.value), val.value)
end
-- Integer encoder
self.encoder['number'] = function( self, val )
local ival = self.encodeInt(val)