handle: validate items in kdbus_items_validate() in KDBUS_CMD_CONN_INFO
authorDjalal Harouni <tixxdz@opendz.org>
Fri, 24 Oct 2014 23:45:28 +0000 (00:45 +0100)
committerDjalal Harouni <tixxdz@opendz.org>
Fri, 24 Oct 2014 23:45:28 +0000 (00:45 +0100)
Try to validate the KDBUS_ITEM_NAME before going further

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
handle.c

index 12f132f834142f69b115ce7117638329d629123b..dabafad7b26308a56f962a1ba30f0181399567f8 100644 (file)
--- a/handle.c
+++ b/handle.c
@@ -861,6 +861,11 @@ static long kdbus_handle_ioctl_ep_connected(struct file *file, unsigned int cmd,
                if (ret < 0)
                        break;
 
+               ret = kdbus_items_validate(cmd_info->items,
+                                          KDBUS_ITEMS_SIZE(cmd_info, items));
+               if (ret < 0)
+                       break;
+
                if (cmd == KDBUS_CMD_CONN_INFO)
                        ret = kdbus_cmd_info(conn, cmd_info);
                else