From edc26007bf50ce165b8f8dfba5e1c7f86f6918e6 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 24 Mar 2011 13:45:32 +0100 Subject: librpc: Return an error if we a broken floor. Pair-Programmed-With: Simo Sorce --- librpc/rpc/binding.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c index 59d508adca..422537e1f4 100644 --- a/librpc/rpc/binding.c +++ b/librpc/rpc/binding.c @@ -653,6 +653,15 @@ _PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, NTSTATUS status; struct dcerpc_binding *binding; + /* + * A tower needs to have at least 4 floors to carry useful + * information. Floor 3 is the transport identifier which defines + * how many floors are required at least. + */ + if (tower->num_floors < 4) { + return NT_STATUS_INVALID_PARAMETER; + } + binding = talloc_zero(mem_ctx, struct dcerpc_binding); NT_STATUS_HAVE_NO_MEMORY(binding); @@ -669,10 +678,6 @@ _PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, return NT_STATUS_NOT_SUPPORTED; } - if (tower->num_floors < 1) { - return NT_STATUS_OK; - } - /* Set object uuid */ status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object); -- cgit