]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
smb: fix wrong data offset when wct = 12 9173/head
authorLancer Cheng <b1tg@protonmail.ch>
Mon, 22 May 2023 09:16:34 +0000 (09:16 +0000)
committerVictor Julien <vjulien@oisf.net>
Fri, 7 Jul 2023 12:42:53 +0000 (14:42 +0200)
Bug: #6008
(cherry picked from commit 000eb91078d5ca88ee93006340d7e68f97ade4bc)

rust/src/smb/smb1_records.rs

index 8747ef84e3d2aa1d4a51e4475c526b7437c51fe4..85ba1bae5876b0063af622c0c64f1a737563a2c2 100644 (file)
@@ -93,7 +93,7 @@ named!(pub parse_smb1_write_andx_request_record<Smb1WriteRequestRecord>,
         >>  _padding_evasion: cond!(data_offset > 36+2*(wct as u16), take!(data_offset - (36+2*(wct as u16))))
         >>  file_data: rest
         >> (Smb1WriteRequestRecord {
-                offset: if high_offset != None { ((high_offset.unwrap() as u64) << 32)|(offset as u64) } else { 0 },
+                offset: ((high_offset.unwrap_or(0) as u64) << 32) | offset as u64,
                 len: (((data_len_high as u32) << 16) as u32)|(data_len_low as u32),
                 fid,
                 data:file_data,