]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
smb: fix broken stream depth setting 6395/head
authorShivani Bhardwaj <shivanib134@gmail.com>
Tue, 7 Sep 2021 12:01:04 +0000 (17:31 +0530)
committerVictor Julien <victor@inliniac.net>
Tue, 21 Sep 2021 05:21:04 +0000 (07:21 +0200)
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

index 3bbb9f8f466695d16f4eefecc33dfa04144169ae..f178de87ae559350d995b0524b09bda0e133e452 100644 (file)
@@ -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::<i32>().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);
         }