From: Shivani Bhardwaj Date: Tue, 7 Sep 2021 12:01:04 +0000 (+0530) Subject: smb: fix broken stream depth setting X-Git-Tag: suricata-7.0.0-beta1~1371 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F6395%2Fhead;p=thirdparty%2Fsuricata.git 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. --- 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); }