From bf3c2a06f58a32cd58a019eff95774eea8305ee2 Mon Sep 17 00:00:00 2001 From: Bernhard Loos Date: Tue, 19 Jul 2011 13:20:39 +0200 Subject: [PATCH] server: Check for STATUS_OBJECT_TYPE_MISMATCH before STATUS_ACCESS_DENIED in get_handle_obj. --- server/handle.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/handle.c b/server/handle.c index 9d91f16c814..c7cd41729c5 100644 --- a/server/handle.c +++ b/server/handle.c @@ -403,14 +403,19 @@ struct object *get_handle_obj( struct process *process, obj_handle_t handle, set_error( STATUS_INVALID_HANDLE ); return NULL; } + obj = entry->ptr; + if (ops && (obj->ops != ops)) + { + set_error( STATUS_OBJECT_TYPE_MISMATCH ); /* not the right type */ + return NULL; + } if ((entry->access & access) != access) { set_error( STATUS_ACCESS_DENIED ); return NULL; } - obj = entry->ptr; } - if (ops && (obj->ops != ops)) + else if (ops && (obj->ops != ops)) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); /* not the right type */ return NULL;