match: read the name from the right structure
authorKay Sievers <kay@vrfy.org>
Thu, 19 Dec 2013 05:34:17 +0000 (06:34 +0100)
committerKay Sievers <kay@vrfy.org>
Thu, 19 Dec 2013 05:34:17 +0000 (06:34 +0100)
match.c

diff --git a/match.c b/match.c
index 99743f404d7fc86ea867ee6f270d57453e2e1358..546617a3081080ab0dfc2f1174ffa54609b543d5 100644 (file)
--- a/match.c
+++ b/match.c
@@ -427,8 +427,9 @@ int kdbus_match_db_add(struct kdbus_conn *conn, void __user *buf)
                case KDBUS_MATCH_NAME_ADD:
                case KDBUS_MATCH_NAME_REMOVE:
                case KDBUS_MATCH_NAME_CHANGE:
-                       if (size > 0) {
-                               ei->name = kstrdup(item->str, GFP_KERNEL);
+                       if (size > sizeof(struct kdbus_notify_name_change)) {
+                               ei->name = kstrdup(item->name_change.name,
+                                                  GFP_KERNEL);
                                if (!ei->name)
                                        ret = -ENOMEM;
                        }