]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
smb/dce_opnum: move range if to outer context
authorEloy Pérez González <zer1t0ps@protonmail.com>
Fri, 22 Oct 2021 13:01:39 +0000 (15:01 +0200)
committerVictor Julien <vjulien@oisf.net>
Mon, 24 Jan 2022 14:37:54 +0000 (15:37 +0100)
The smb dce_opnum matches all the opnums that are higher that the
indicated opnum. This is due the range comparison if was put in the
exact comparison context, and in case the opnum doesn't match exactly,
then the range comparison is triggered (the upper limit is always true).

Move the erroneus if to the outer context, as else option of the block
checks if comparison should be exact or range.

Ticket: 4767

rust/src/smb/detect.rs

index 6072e1131b621572933e0291c59ba462f2ce5941..1c77d74608479e60aeea2316b6212b1f6c632290 100644 (file)
@@ -111,9 +111,9 @@ pub extern "C" fn rs_smb_tx_match_dce_opnum(tx: &mut SMBTransaction,
                     if range.range2 == DETECT_DCE_OPNUM_RANGE_UNINITIALIZED {
                         if range.range1 == x.opnum as u32 {
                             return 1;
-                        } else if range.range1 <= x.opnum as u32 && range.range2 >= x.opnum as u32 {
-                            return 1;
                         }
+                    } else if range.range1 <= x.opnum as u32 && range.range2 >= x.opnum as u32 {
+                        return 1;
                     }
                 }
             }