From: Shivani Bhardwaj Date: Fri, 5 Jun 2020 14:35:21 +0000 (+0530) Subject: dcerpc: fix tests to have a valid header X-Git-Tag: suricata-6.0.0-beta1~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ce7d98af136ca5cfe62888eba585bd131a8fe01;p=thirdparty%2Fsuricata.git dcerpc: fix tests to have a valid header --- diff --git a/rust/src/dcerpc/dcerpc.rs b/rust/src/dcerpc/dcerpc.rs index 7617e56d3c..d271ab3dd7 100644 --- a/rust/src/dcerpc/dcerpc.rs +++ b/rust/src/dcerpc/dcerpc.rs @@ -1141,6 +1141,10 @@ mod tests { #[test] fn test_process_bind_pdu() { + let header: &[u8] = &[ + 0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, + ]; let bind: &[u8] = &[ 0xd0, 0x16, 0xd0, 0x16, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x2c, 0xd0, 0x28, 0xda, 0x76, 0x91, 0xf6, 0x6e, 0xcb, 0x0f, 0xbf, 0x85, @@ -1221,11 +1225,16 @@ mod tests { 0x02, 0x00, 0x00, 0x00, ]; let mut dcerpc_state = DCERPCState::new(); + assert_eq!(16, dcerpc_state.process_header(header)); assert_eq!(1068, dcerpc_state.process_bind_pdu(bind)); } #[test] fn test_handle_bindctxitem() { + let header: &[u8] = &[ + 0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, + ]; let bind: &[u8] = &[ 0x00, 0x00, 0x01, 0x00, 0x2c, 0xd0, 0x28, 0xda, 0x76, 0x91, 0xf6, 0x6e, 0xcb, 0x0f, 0xbf, 0x85, 0xcd, 0x9b, 0xf6, 0x39, 0x01, 0x00, 0x03, 0x00, 0x04, 0x5d, 0x88, 0x8a, @@ -1233,6 +1242,7 @@ mod tests { 0x00, 0x00, ]; let mut dcerpc_state = DCERPCState::new(); + assert_eq!(16, dcerpc_state.process_header(header)); assert_eq!(44, dcerpc_state.handle_bindctxitem(bind, 0)); } diff --git a/rust/src/dcerpc/dcerpc_udp.rs b/rust/src/dcerpc/dcerpc_udp.rs index 3d1adf663d..cd168408c8 100644 --- a/rust/src/dcerpc/dcerpc_udp.rs +++ b/rust/src/dcerpc/dcerpc_udp.rs @@ -418,6 +418,7 @@ mod tests { 0xff, 0xff, 0xff, 0xff, 0x68, 0x00, 0x00, 0x00, 0x0a, 0x00, ]; let mut dcerpcudp_state = DCERPCUDPState::new(); + assert_eq!(80, dcerpcudp_state.process_header(request)); assert_eq!( 0, dcerpcudp_state.handle_fragment_data(request, request.len() as u16)