All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vpn: Fix extracting of PrefixLength D-Bus value
@ 2025-04-14 16:10 Jussi Laakkonen
  2025-04-14 17:10 ` patchwork-bot+connman
  0 siblings, 1 reply; 2+ messages in thread
From: Jussi Laakkonen @ 2025-04-14 16:10 UTC (permalink / raw)
  To: connman

The PrefixLength value is stored as a DBUS_TYPE_BYTE, and is an unsigned
char, thus should be read as such. This fixes crash when trying to read
the value into a char*.
---
 plugins/vpn.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/plugins/vpn.c b/plugins/vpn.c
index 42396d2a..332d8e83 100644
--- a/plugins/vpn.c
+++ b/plugins/vpn.c
@@ -412,8 +412,8 @@ static int extract_ip(DBusMessageIter *array, int family,
 			dbus_message_iter_get_basic(&value, &netmask);
 			DBG("netmask %s", netmask);
 		} else if (g_str_equal(key, "PrefixLength")) {
-			dbus_message_iter_get_basic(&value, &netmask);
-			DBG("prefix length %s", netmask);
+			dbus_message_iter_get_basic(&value, &prefix_len);
+			DBG("prefix length %u", prefix_len);
 		} else if (g_str_equal(key, "Peer")) {
 			dbus_message_iter_get_basic(&value, &peer);
 			DBG("peer %s", peer);
@@ -436,7 +436,6 @@ static int extract_ip(DBusMessageIter *array, int family,
 								gateway);
 		break;
 	case AF_INET6:
-		prefix_len = atoi(netmask);
 		connman_ipaddress_set_ipv6(data->ip, address, prefix_len,
 								gateway);
 		break;
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-14 17:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 16:10 [PATCH] vpn: Fix extracting of PrefixLength D-Bus value Jussi Laakkonen
2025-04-14 17:10 ` patchwork-bot+connman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.