Fix a crash when parsing events
authorMike Gorse <mgorse@suse.com>
Wed, 5 Dec 2012 05:54:55 +0000 (23:54 -0600)
committerMike Gorse <mgorse@suse.com>
Wed, 5 Dec 2012 05:54:55 +0000 (23:54 -0600)
If an event listener specifies a detail for an event, but an event
arrives with an empty detail, then libatspi might crash.

atspi/atspi-event-listener.c

index 9152054..bd8da50 100644 (file)
@@ -802,6 +802,9 @@ detail_matches_listener (const char *event_detail, const char *listener_detail)
   if (!listener_detail)
     return TRUE;
 
+  if (!event_detail)
+    return (listener_detail ? FALSE : TRUE);
+
   return !(listener_detail [strcspn (listener_detail, ":")] == '\0'
                ? strncmp (listener_detail, event_detail,
                           strcspn (event_detail, ":"))