From: Pierre Chifflier Date: Fri, 8 Feb 2019 13:43:45 +0000 (+0100) Subject: rust: nom4 requires to add complete!() when using many! combinators X-Git-Tag: suricata-5.0.0-beta1~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f22695130b46f4227252de86c54d848ce75492d8;p=thirdparty%2Fsuricata.git rust: nom4 requires to add complete!() when using many! combinators --- diff --git a/rust/src/dhcp/parser.rs b/rust/src/dhcp/parser.rs index c50ffd6fc6..677b26d7ab 100644 --- a/rust/src/dhcp/parser.rs +++ b/rust/src/dhcp/parser.rs @@ -192,7 +192,7 @@ named!(pub parse_option, /// Parse and return all the options. Upon the end of option indicator /// all the data will be consumed. -named!(pub parse_all_options>, many0!(call!(parse_option))); +named!(pub parse_all_options>, many0!(complete!(call!(parse_option)))); pub fn dhcp_parse(input: &[u8]) -> IResult<&[u8], DHCPMessage> { match parse_header(input) { diff --git a/rust/src/dns/parser.rs b/rust/src/dns/parser.rs index 15c2bb52bd..4e1d551ef3 100644 --- a/rust/src/dns/parser.rs +++ b/rust/src/dns/parser.rs @@ -179,7 +179,7 @@ fn dns_parse_answer<'a>(slice: &'a [u8], message: &'a [u8], count: usize) let result: IResult<&'a [u8], Vec>> = closure!(&'a [u8], do_parse!( rdata: many_m_n!(1, n, - apply!(dns_parse_rdata, message, rrtype)) + complete!(apply!(dns_parse_rdata, message, rrtype))) >> (rdata) ))(data); match result { diff --git a/rust/src/nfs/nfs4_records.rs b/rust/src/nfs/nfs4_records.rs index f758a86c4c..270e7b68f2 100644 --- a/rust/src/nfs/nfs4_records.rs +++ b/rust/src/nfs/nfs4_records.rs @@ -672,7 +672,7 @@ named!(nfs4_res_readdir_ok, do_parse!( _verifier: be_u64 // run parser until we find a 'value follows == 0' - >> listing: many_till!(call!(nfs4_res_readdir_entry), peek!(tag!(b"\x00\x00\x00\x00"))) + >> listing: many_till!(complete!(call!(nfs4_res_readdir_entry)), peek!(tag!(b"\x00\x00\x00\x00"))) // value follows == 0 checked by line above >> _value_follows: be_u32 >> eof: be_u32 diff --git a/rust/src/smb/smb1_records.rs b/rust/src/smb/smb1_records.rs index 084bfa0fb8..15f45e6943 100644 --- a/rust/src/smb/smb1_records.rs +++ b/rust/src/smb/smb1_records.rs @@ -160,7 +160,7 @@ named!(pub parse_smb1_negotiate_protocol_record, _wtc: le_u8 >> _bcc: le_u16 // dialects is a list of [1 byte buffer format][string][0 terminator] - >> dialects: many1!(take_until_and_consume!("\0")) + >> dialects: many1!(complete!(take_until_and_consume!("\0"))) >> (Smb1NegotiateProtocolRecord { dialects }))