From: Victor Julien Date: Mon, 21 Feb 2022 11:20:13 +0000 (+0100) Subject: nfs4: verify bool fields X-Git-Tag: suricata-6.0.5~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fba08a27d843237c7a8987ea436d40eb0e60c51;p=thirdparty%2Fsuricata.git nfs4: verify bool fields (cherry picked from commit 5ecb626e50048cfa43ad67cdd80307377e90926c) --- diff --git a/rust/src/nfs/nfs4_records.rs b/rust/src/nfs/nfs4_records.rs index e4f391f1e8..73ac2c8655 100644 --- a/rust/src/nfs/nfs4_records.rs +++ b/rust/src/nfs/nfs4_records.rs @@ -573,7 +573,7 @@ pub struct Nfs4ResponseRead<'a> { named!(nfs4_res_read_ok, do_parse!( - eof: be_u32 + eof: verify!(be_u32, |&v| v <= 1) >> read_len: be_u32 >> read_data: take!(read_len) >> (Nfs4ResponseRead { @@ -663,7 +663,7 @@ named!(nfs4_res_readdir_entry_do, named!(nfs4_res_readdir_entry>, do_parse!( - value_follows: be_u32 + value_follows: verify!(be_u32, |&v| v <= 1) >> entry: cond!(value_follows == 1, nfs4_res_readdir_entry_do) >> (entry) )); @@ -674,8 +674,8 @@ named!(nfs4_res_readdir_ok, // run parser until we find a 'value follows == 0' >> 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 + >> _value_follows: tag!(b"\x00\x00\x00\x00") + >> eof: verify!(be_u32, |&v| v <= 1) >> ( Nfs4ResponseReaddir { eof: eof==1, listing: listing.0 }) ));