]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
smb: fix wrong data offset when wct = 12
authorLancer Cheng <b1tg@protonmail.ch>
Mon, 22 May 2023 09:16:34 +0000 (09:16 +0000)
committerVictor Julien <vjulien@oisf.net>
Mon, 5 Jun 2023 09:17:16 +0000 (11:17 +0200)
Bug: #6008

rust/src/smb/smb1_records.rs

index ce3f9194ec600162010c6f7fad2fffa62d1e9250..24e1928b55a00ba8c07a25c93f31698524a02b0d 100644 (file)
@@ -114,7 +114,7 @@ pub fn parse_smb1_write_andx_request_record(i : &[u8], andx_offset: usize) -> IR
     let (i, _padding_evasion) = cond(data_offset > ax+4+2*(wct as u16), |b| take(data_offset - (ax+4+2*(wct as u16)))(b))(i)?;
     let (i, file_data) = rest(i)?;
     let record = Smb1WriteRequestRecord {
-        offset: high_offset.map(|ho| (ho as u64) << 32 | offset as u64).unwrap_or(0),
+        offset: ((high_offset.unwrap_or(0) as u64) << 32) | offset as u64,
         len: ((data_len_high as u32) << 16)|(data_len_low as u32),
         fid,
         data: file_data,