1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 04:09:01 +00:00

Add explicit endianness modifiers in several places.

This commit is contained in:
dmiller
2018-09-06 14:20:30 +00:00
parent 9ba660d330
commit 8b371c3b96
2 changed files with 10 additions and 10 deletions

View File

@@ -542,7 +542,7 @@ Proto = {
local quantum = 1024 local quantum = 1024
local data, packet, status local data, packet, status
data = bin.pack( "CCI", option, option_len, quantum ) data = bin.pack( ">CCI", option, option_len, quantum )
packet = self:create_fp_packet( REQUEST.OpenSession, data_offset, data ) packet = self:create_fp_packet( REQUEST.OpenSession, data_offset, data )
self:send_fp_packet( packet ) self:send_fp_packet( packet )
@@ -787,7 +787,7 @@ Proto = {
local bitmap = USER_BITMAP.UserId local bitmap = USER_BITMAP.UserId
local result = {} local result = {}
local data = bin.pack( "CCI>S", COMMAND.FPGetUserInfo, flags, uid, bitmap ) local data = bin.pack( ">CCIS", COMMAND.FPGetUserInfo, flags, uid, bitmap )
packet = self:create_fp_packet( REQUEST.Command, data_offset, data ) packet = self:create_fp_packet( REQUEST.Command, data_offset, data )
self:send_fp_packet( packet ) self:send_fp_packet( packet )

View File

@@ -91,7 +91,7 @@ local function decodeHeader( data, pos )
local response = {} local response = {}
local pos, tmp = pos or 1, 0 local pos, tmp = pos or 1, 0
pos, tmp = bin.unpack( "I", data, pos ) pos, tmp = bin.unpack( "<I", data, pos )
response.len = ( tmp & 255 ) response.len = ( tmp & 255 )
response.number = ( tmp >> 24 ) response.number = ( tmp >> 24 )
@@ -244,7 +244,7 @@ function loginRequest( socket, params, username, password, salt )
hash = createLoginHash( password, salt ) hash = createLoginHash( password, salt )
end end
local packet = bin.pack( "SSICAzp", local packet = bin.pack( "<SSICAzp",
clicap, clicap,
extcapabilities, extcapabilities,
MAXPACKET, MAXPACKET,
@@ -256,7 +256,7 @@ function loginRequest( socket, params, username, password, salt )
local tmp = packet:len() + ( packetno << 24 ) local tmp = packet:len() + ( packetno << 24 )
packet = bin.pack( "I", tmp ) .. packet packet = bin.pack( "<I", tmp ) .. packet
try( socket:send(packet) ) try( socket:send(packet) )
packet = try( socket:receive_bytes(HEADER_SIZE) ) packet = try( socket:receive_bytes(HEADER_SIZE) )
@@ -273,7 +273,7 @@ function loginRequest( socket, params, username, password, salt )
pos, is_error = bin.unpack( "C", packet, pos ) pos, is_error = bin.unpack( "C", packet, pos )
if is_error > 0 then if is_error > 0 then
pos, response.errorcode = bin.unpack( "S", packet, pos ) pos, response.errorcode = bin.unpack( "<S", packet, pos )
local has_sqlstate local has_sqlstate
pos, has_sqlstate = bin.unpack( "C", packet, pos ) pos, has_sqlstate = bin.unpack( "C", packet, pos )
@@ -288,8 +288,8 @@ function loginRequest( socket, params, username, password, salt )
else else
response.errorcode = 0 response.errorcode = 0
pos, response.affectedrows = bin.unpack( "C", packet, pos ) pos, response.affectedrows = bin.unpack( "C", packet, pos )
pos, response.serverstatus = bin.unpack( "S", packet, pos ) pos, response.serverstatus = bin.unpack( "<S", packet, pos )
pos, response.warnings = bin.unpack( "S", packet, pos ) pos, response.warnings = bin.unpack( "<S", packet, pos )
end end
return true, response return true, response
@@ -335,9 +335,9 @@ function decodeField( data, pos )
pos, _ = bin.unpack( "C", data, pos ) pos, _ = bin.unpack( "C", data, pos )
-- charset, in my case 0x0800 -- charset, in my case 0x0800
pos, _ = bin.unpack( "S", data, pos ) pos, _ = bin.unpack( "<S", data, pos )
pos, field.length = bin.unpack( "I", data, pos ) pos, field.length = bin.unpack( "<I", data, pos )
pos, field.type = bin.unpack( "A6", data, pos ) pos, field.type = bin.unpack( "A6", data, pos )
return pos, field return pos, field