From: Philippe Antoine Date: Sat, 2 Apr 2022 19:16:53 +0000 (+0200) Subject: dcerpc: store consumed_bytes as i32 X-Git-Tag: suricata-7.0.0-beta1~744 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=704bc878ea3f2fcb911d38b6a21aa5a7ee4d2a79;p=thirdparty%2Fsuricata.git dcerpc: store consumed_bytes as i32 As it can grow bigger than u16 --- diff --git a/rust/src/dcerpc/dcerpc.rs b/rust/src/dcerpc/dcerpc.rs index a4758366ab..3dac2a0a48 100644 --- a/rust/src/dcerpc/dcerpc.rs +++ b/rust/src/dcerpc/dcerpc.rs @@ -301,7 +301,7 @@ pub struct DCERPCState { pub buffer_tc: Vec, pub pad: u8, pub padleft: u16, - pub bytes_consumed: u16, + pub bytes_consumed: i32, pub tx_id: u64, pub query_completed: bool, pub data_needed_for_dir: Direction, @@ -966,7 +966,7 @@ impl DCERPCState { // Check if header data was complete. In case of EoF or incomplete data, wait for more // data else return error - if self.bytes_consumed < DCERPC_HDR_LEN && input_len > 0 { + if self.bytes_consumed < DCERPC_HDR_LEN.into() && input_len > 0 { parsed = self.process_header(buffer); if parsed == -1 { self.extend_buffer(buffer, direction); @@ -975,7 +975,7 @@ impl DCERPCState { if parsed == -2 { return AppLayerResult::err(); } - self.bytes_consumed += parsed as u16; + self.bytes_consumed += parsed; } let fraglen = self.get_hdr_fraglen().unwrap_or(0); @@ -987,7 +987,7 @@ impl DCERPCState { } else { self.query_completed = true; } - parsed = self.bytes_consumed as i32; + parsed = self.bytes_consumed; let current_call_id = self.get_hdr_call_id().unwrap_or(0); @@ -1058,7 +1058,7 @@ impl DCERPCState { return AppLayerResult::err(); } } - self.bytes_consumed += retval as u16; + self.bytes_consumed += retval; // If the query has been completed, clean the buffer and reset the direction if self.query_completed == true {