From b2a5e64a1e79b0c112e764e691050a63ae9e49ec Mon Sep 17 00:00:00 2001 From: Emmanuel VAUTRIN Date: Thu, 6 Jan 2022 15:11:34 +0100 Subject: [PATCH] iwd: Fix connection with no passphrase During a failing connection on a secure network with no passphrase, agent_request_passphrase() crashes, trying to manipulate the value of the "WiFi.Passphrase" key, which is null. --- plugins/iwd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/iwd.c b/plugins/iwd.c index b0e17a4d6396..b524a731fb92 100644 --- a/plugins/iwd.c +++ b/plugins/iwd.c @@ -1489,6 +1489,8 @@ static DBusMessage *agent_request_passphrase(DBusConnection *dbus_conn, return get_reply_on_error(message, EINVAL); passwd = connman_network_get_string(iwdn->network, "WiFi.Passphrase"); + if (!passwd) + return get_reply_on_error(message, ENOKEY); return g_dbus_create_reply(message, DBUS_TYPE_STRING, &passwd, DBUS_TYPE_INVALID); -- 2.25.1