Re: [MM] [PATCH] device: check for NULL driver in add_port_driver



On 17/05/13 20:05, Ben Chan wrote:
This patch fixes a crash in MMDevice::add_port_driver() due to
g_str_equal() dereferencing a NULL driver returned by
mm_device_utils_get_port_driver().

Bug reported on https://code.google.com/p/chromium/issues/detail?id=241823

Pushed, thanks.

---
 src/mm-device.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mm-device.c b/src/mm-device.c
index bfc4b36..54f6456 100644
--- a/src/mm-device.c
+++ b/src/mm-device.c
@@ -255,6 +255,8 @@ add_port_driver (MMDevice *self,
     guint i;
 
     driver = mm_device_utils_get_port_driver (udev_port);
+    if (!driver)
+        return;
 
     n_items = (self->priv->drivers ? g_strv_length (self->priv->drivers) : 0);
     if (n_items > 0) {



-- 
Aleksander


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]