From 84bbf02e95639536c34140906aa4652ad61ea2c3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 26 Oct 2004 05:36:14 +0000 Subject: r3239: reads of more than UINT16_MAX bytes should return 0 bytes (This used to be commit 16c7dd641707b6b8b3159290ca9fa08053a10692) --- source4/ntvfs/ipc/vfs_ipc.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c index dcbfdb948f..f7eac65712 100644 --- a/source4/ntvfs/ipc/vfs_ipc.c +++ b/source4/ntvfs/ipc/vfs_ipc.c @@ -365,17 +365,23 @@ static NTSTATUS ipc_read(struct ntvfs_module_context *ntvfs, } fnum = rd->readx.in.fnum; - data.length = rd->readx.in.maxcnt; - data.data = rd->readx.out.data; p = pipe_state_find(private, fnum); if (!p) { return NT_STATUS_INVALID_HANDLE; } - status = dcesrv_output_blob(p->dce_conn, &data); - if (NT_STATUS_IS_ERR(status)) { - return status; + data.length = rd->readx.in.maxcnt; + data.data = rd->readx.out.data; + if (data.length > UINT16_MAX) { + data.length = 0; + } + + if (data.length != 0) { + status = dcesrv_output_blob(p->dce_conn, &data); + if (NT_STATUS_IS_ERR(status)) { + return status; + } } rd->readx.out.remaining = 0; -- cgit