Skip to content

Commit

Permalink
dcerpc: prevent integer underflow
Browse files Browse the repository at this point in the history
in case a fragment has a length lesser than DCERPC_HDR_LEN

Fixes: 9daf852 ("dcerpc: tidy up code")

Ticket: 7548
  • Loading branch information
catenacyber committed Feb 5, 2025
1 parent d4330ef commit 05fa4e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rust/src/dcerpc/dcerpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 05fa4e5

Please sign in to comment.