From 42da0fb5c5c35b723e601d3636582155a9a5028a Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Tue, 7 Sep 2021 17:31:04 +0530 Subject: [PATCH] smb: fix broken stream depth setting The stream depth setting was broken since it was moved to Rust because of a missing parser for memory values in configuration. Use get_memval fn from conf.rs to calculate and fetch the correct values. --- rust/src/smb/smb.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/rust/src/smb/smb.rs b/rust/src/smb/smb.rs index 3bbb9f8f46..f178de87ae 100644 --- a/rust/src/smb/smb.rs +++ b/rust/src/smb/smb.rs @@ -2282,11 +2282,9 @@ pub unsafe extern "C" fn rs_smb_register_parser() { SCLogDebug!("Rust SMB parser registered."); let retval = conf_get("app-layer.protocols.smb.stream-depth"); if let Some(val) = retval { - let val = val.parse::().unwrap(); - if val < 0 { - SCLogError!("invalid value for stream-depth"); - } else { - stream_depth = val as u32; + match get_memval(val) { + Ok(retval) => { stream_depth = retval as u32; } + Err(_) => { SCLogError!("Invalid depth value"); } } AppLayerParserSetStreamDepth(IPPROTO_TCP as u8, ALPROTO_SMB, stream_depth); } -- 2.47.2