[PATCH] mountmgr.sys: Avoid use after free in dhcp4_config_request().

Paul Gofman pgofman at codeweavers.com
Tue Dec 14 12:53:46 CST 2021


Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
    Sometime path gets corrupted which causes assertion in dbus_message_new_method_call() due to invalid path
    which crashes the driver process, making, in particular, iphlpapi non functional.

 dlls/mountmgr.sys/dbus.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/mountmgr.sys/dbus.c b/dlls/mountmgr.sys/dbus.c
index 28b229f03d0..581d45e7702 100644
--- a/dlls/mountmgr.sys/dbus.c
+++ b/dlls/mountmgr.sys/dbus.c
@@ -635,11 +635,15 @@ static DBusMessage *dhcp4_config_request( const char *iface )
 
     p_dbus_message_iter_init( reply, &iter );
     if (p_dbus_message_iter_get_arg_type( &iter ) == DBUS_TYPE_OBJECT_PATH) p_dbus_message_iter_get_basic( &iter, &path );
-    p_dbus_message_unref( reply );
-    if (!path) return NULL;
+    if (!path)
+    {
+        p_dbus_message_unref( reply );
+        return NULL;
+    }
 
     request = p_dbus_message_new_method_call( "org.freedesktop.NetworkManager", path,
                                               "org.freedesktop.DBus.Properties", "Get" );
+    p_dbus_message_unref( reply );
     if (!request) return NULL;
 
     p_dbus_message_iter_init_append( request, &iter );
-- 
2.33.1




More information about the wine-devel mailing list