[PATCH] connection: Check object types in message parameters

Benjamin Franzke benjaminfranzke at googlemail.com
Mon Oct 31 03:06:35 PDT 2011


---
 src/connection.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index 1963314..a10508d 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -594,6 +594,16 @@ wl_connection_demarshal(struct wl_connection *connection,
 				goto err;
 			}
 
+			if (*object != NULL && message->types[i-2] != NULL &&
+			    (*object)->interface != message->types[i-2]) {
+				printf("invalid object (%d), type (%s), "
+					"message %s(%s)\n",
+				       *p, (*object)->interface->name,
+				       message->name, message->signature);
+				errno = EINVAL;
+				goto err;
+			}
+
 			p++;
 			break;
 		case 'n':
-- 
1.7.3.4



More information about the wayland-devel mailing list