Validate notification type before casting
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 9 Nov 2016 19:17:30 +0000 (14:17 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 18:09:06 +0000 (14:09 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
lib/plugin-system/notification/event.c

index 9163cb0cf469b42a3b449692766bfdb0176259e4..9d99a0d69a847ece158cc56eb386e23a20f26fb8 100644 (file)
@@ -58,9 +58,16 @@ error:
 struct bt_ctf_event *bt_notification_event_get_event(
                struct bt_notification *notification)
 {
+       struct bt_ctf_event *event = NULL;
        struct bt_notification_event *event_notification;
 
+       if (bt_notification_get_type(notification) !=
+                       BT_NOTIFICATION_TYPE_EVENT) {
+               goto end;
+       }
        event_notification = container_of(notification,
                        struct bt_notification_event, parent);
-       return bt_get(event_notification->event);
+       event = bt_get(event_notification->event);
+end:
+       return event;
 }
This page took 0.025555 seconds and 4 git commands to generate.