1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-03 05:09:14 +00:00

Use explicit endianness in pack/unpack.

This commit is contained in:
dmiller
2017-02-14 03:47:49 +00:00
parent 2f104650a8
commit f20589ca09
13 changed files with 30 additions and 19 deletions

View File

@@ -131,7 +131,7 @@ function toBson(dict)
end
dbg("Packet length is %d",length)
--Final pack
return true, bin.pack("I", length) .. elements .. "\0"
return true, bin.pack("<I", length) .. elements .. "\0"
end
-- Reads a null-terminated string. If length is supplied, it is just cut
@@ -376,7 +376,7 @@ MongoData ={
--Adds unsigned int32 to the message body
--@param value the value to add
function MongoData:addUnsignedInt32(value)
self.valueString = self.valueString..bin.pack("I",value)
self.valueString = self.valueString..bin.pack("<I",value)
end
-- Adds a string to the message body
--@param value the string to add