]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dcerpc: prevent integer underflow 12553/head
authorPhilippe Antoine <pantoine@oisf.net>
Mon, 3 Feb 2025 15:20:20 +0000 (16:20 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 10 Feb 2025 19:01:36 +0000 (20:01 +0100)
in case a fragment has a length lesser than DCERPC_HDR_LEN

Fixes: 9daf8528b72c ("dcerpc: tidy up code")
Ticket: 7548

rust/src/dcerpc/dcerpc.rs

index a7b18b2be797c0df6f0024dbab04df29c0947b68..57a57e6e1f8d2632dd5894610aaa22f46be3645c 100644 (file)
@@ -938,7 +938,7 @@ impl DCERPCState {
 
         let fraglen = self.get_hdr_fraglen().unwrap_or(0);
 
-        if cur_i.len() < (fraglen - frag_bytes_consumed) as usize {
+        if (cur_i.len() + frag_bytes_consumed as usize) < fraglen as usize {
             SCLogDebug!("Possibly fragmented data, waiting for more..");
             return AppLayerResult::incomplete(parsed as u32, fraglen as u32 - parsed as u32);
         }