From 8a1af5c367b00616726eab28ba7819285647dce5 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 19 Jul 2018 15:45:08 +0200 Subject: [PATCH] nfs4: remove panic calls, set events instead --- rust/src/nfs/nfs4.rs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/rust/src/nfs/nfs4.rs b/rust/src/nfs/nfs4.rs index a5d85fc089..34cae4a59f 100644 --- a/rust/src/nfs/nfs4.rs +++ b/rust/src/nfs/nfs4.rs @@ -213,7 +213,11 @@ impl NFSState { self.set_event(NFSEvent::MalformedData); return 0; }, - IResult::Error(e) => { panic!("NFSPROC4_COMPOUND/GSS INTEGRITIY: Parsing failed: {:?}",e); }, + IResult::Error(_e) => { + SCLogDebug!("NFSPROC4_COMPOUND/GSS INTEGRITIY: Parsing failed: {:?}", _e); + self.set_event(NFSEvent::MalformedData); + return 0; + }, } } } @@ -227,7 +231,10 @@ impl NFSState { SCLogDebug!("NFSPROC4_COMPOUND: INCOMPLETE {:?}", _n); self.set_event(NFSEvent::MalformedData); }, - IResult::Error(e) => { panic!("NFSPROC4_COMPOUND: Parsing failed: {:?}",e); }, + IResult::Error(_e) => { + SCLogDebug!("NFSPROC4_COMPOUND: Parsing failed: {:?}", _e); + self.set_event(NFSEvent::MalformedData); + }, }; } @@ -312,7 +319,11 @@ impl NFSState { self.set_event(NFSEvent::MalformedData); return 0; }, - IResult::Error(e) => { panic!("NFSPROC4_COMPOUND/GSS INTEGRITIY: Parsing failed: {:?}",e); }, + IResult::Error(_e) => { + SCLogDebug!("NFSPROC4_COMPOUND/GSS INTEGRITIY: Parsing failed: {:?}", _e); + self.set_event(NFSEvent::MalformedData); + return 0; + }, } } match parse_nfs4_response_compound(data) { @@ -323,7 +334,10 @@ impl NFSState { IResult::Incomplete(_) => { self.set_event(NFSEvent::MalformedData); }, - IResult::Error(e) => { panic!("Parsing failed: {:?}",e); }, + IResult::Error(_e) => { + SCLogDebug!("Parsing failed: {:?}", _e); + self.set_event(NFSEvent::MalformedData); + }, }; } 0