CVE-2015-5370: s3:rpc_client: protect rpc_api_pipe_got_pdu() against too large payloads
authorStefan Metzmacher <metze@samba.org>
Fri, 10 Jul 2015 12:48:38 +0000 (14:48 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 12 Apr 2016 17:25:31 +0000 (19:25 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
source3/rpc_client/cli_pipe.c

index 56e5d174db70cbea4b688c6ca233825149d079b4..26f709df2c5ec7442307cbd21918a5209b76737e 100644 (file)
@@ -990,6 +990,11 @@ static void rpc_api_pipe_got_pdu(struct tevent_req *subreq)
                return;
        }
 
+       if (state->reply_pdu_offset + rdata.length > MAX_RPC_DATA_SIZE) {
+               tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
+               return;
+       }
+
        /* Now copy the data portion out of the pdu into rbuf. */
        if (state->reply_pdu.length < state->reply_pdu_offset + rdata.length) {
                if (!data_blob_realloc(NULL, &state->reply_pdu,