Skip to content

Commit

Permalink
librpc/rpc: let dcerpc_read_ncacn_packet_next_vector() handle fragmen…
Browse files Browse the repository at this point in the history
…ts without any payload

DCERPC_PKT_CO_CANCEL and DCERPC_PKT_ORPHANED don't have any payload by
default. In order to receive them via dcerpc_read_ncacn_packet_send/recv
we need to allow fragments with frag_len == DCERPC_NCACN_PAYLOAD_OFFSET.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15446

Signed-off-by: Stefan Metzmacher <[email protected]>
Reviewed-by: Volker Lendecke <[email protected]>
(cherry picked from commit 5c724a3)
  • Loading branch information
metze-samba authored and Jule Anger committed Aug 8, 2023
1 parent a436b0d commit b9e4804
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions librpc/rpc/dcerpc_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,14 @@ static int dcerpc_read_ncacn_packet_next_vector(struct tstream_context *stream,

ofs = state->buffer.length;

if (frag_len < ofs) {
if (frag_len <= ofs) {
/*
* something is wrong, let the caller deal with it
* With frag_len == ofs, we are done, this is likely
* a DCERPC_PKT_CO_CANCEL and DCERPC_PKT_ORPHANED
* without any payload.
*
* Otherwise it's a broken packet and we
* let the caller deal with it.
*/
*_vector = NULL;
*_count = 0;
Expand Down

0 comments on commit b9e4804

Please sign in to comment.