[pulseaudio-discuss] [PATCH] module-stream-restore: With dbus-proto fix segfault if e->device is NULL.
Juho Hämäläinen
jusa at hilvi.org
Tue Apr 26 13:11:44 UTC 2016
If first part of test is false and e->device is NULL pa_streq will
segfault. Fix by using pa_safe_streq, which checks strings for NULL
before doing strcmp.
---
src/modules/module-stream-restore.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index 37555a8..d1c2597 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -645,7 +645,7 @@ static void handle_add_entry(DBusConnection *conn, DBusMessage *msg, void *userd
e->channel_map = map;
e->volume_valid = !!map.channels;
- device_updated = (e->device_valid != !!device[0]) || !pa_streq(e->device, device);
+ device_updated = (e->device_valid != !!device[0]) || !pa_safe_streq(e->device, device);
pa_xfree(e->device);
e->device = pa_xstrdup(device);
e->device_valid = !!device[0];
@@ -757,7 +757,7 @@ static void handle_entry_set_device(DBusConnection *conn, DBusMessage *msg, DBus
pa_assert_se(e = entry_read(de->userdata, de->entry_name));
- updated = (e->device_valid != !!device[0]) || !pa_streq(e->device, device);
+ updated = (e->device_valid != !!device[0]) || !pa_safe_streq(e->device, device);
if (updated) {
pa_xfree(e->device);
--
2.1.4
More information about the pulseaudio-discuss
mailing list