From 4b00d94eb98368ef8dfbf7f08ad0e495193558d0 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 21 Feb 2022 12:20:13 +0100 Subject: [PATCH] nfs4: verify bool fields (cherry picked from commit 5ecb626e50048cfa43ad67cdd80307377e90926c) --- rust/src/nfs/nfs4_records.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/src/nfs/nfs4_records.rs b/rust/src/nfs/nfs4_records.rs index 1d2b1b1cf5..005a1f14c1 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 }) )); -- 2.47.2