bus_driver_handle_become_monitor: Don't leak zero-length array of rules

Only privileged users can trigger this leak, so it is not a denial of
service attack.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2018-08-17 15:33:10 +01:00
parent c018e0b1b2
commit 5accf42aab

View file

@ -2258,6 +2258,7 @@ bus_driver_handle_become_monitor (DBusConnection *connection,
/* Special case: a zero-length array becomes [""] */
if (n_match_rules == 0)
{
dbus_free (match_rules);
match_rules = dbus_malloc (2 * sizeof (char *));
if (match_rules == NULL)