summaryrefslogtreecommitdiffstats
path: root/source3/lib/packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/packet.c')
-rw-r--r--source3/lib/packet.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/source3/lib/packet.c b/source3/lib/packet.c
index 72de30e8ca8..ef28bf9f625 100644
--- a/source3/lib/packet.c
+++ b/source3/lib/packet.c
@@ -140,15 +140,21 @@ bool packet_handler(struct packet_context *ctx,
return true;
}
- buf = (uint8_t *)TALLOC_MEMDUP(ctx, ctx->in.data, length);
- if (buf == NULL) {
- *status = NT_STATUS_NO_MEMORY;
- return true;
- }
+ if (length == ctx->in.length) {
+ buf = ctx->in.data;
+ ctx->in.data = NULL;
+ ctx->in.length = 0;
+ } else {
+ buf = (uint8_t *)TALLOC_MEMDUP(ctx, ctx->in.data, length);
+ if (buf == NULL) {
+ *status = NT_STATUS_NO_MEMORY;
+ return true;
+ }
- memmove(ctx->in.data, ctx->in.data + length,
- ctx->in.length - length);
- ctx->in.length -= length;
+ memmove(ctx->in.data, ctx->in.data + length,
+ ctx->in.length - length);
+ ctx->in.length -= length;
+ }
*status = callback(buf, length, priv);
return True;