[PATCH 3/8] vpn: Avoid using uninitialized prefix_len

Jussi Laakkonen <[email protected]> Thu, 10 Apr 2025 18:58:41 +0300
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
Clang complains about the prefix_len being possibly uninitialized. Set
the max for IPv6 prefix len as the value.
---
 plugins/vpn.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/vpn.c b/plugins/vpn.c
index 42396d2a..9664c82f 100644
--- a/plugins/vpn.c
+++ b/plugins/vpn.c
@@ -4,6 +4,7 @@
  *
  *  Copyright (C) 2012-2013  Intel Corporation. All rights reserved.
  *  Copyright (C) 2019-2021  Jolla Ltd. All rights reserved.
+ *  Copyright (C) 2025  Jolla Mobile Ltd
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -388,7 +389,7 @@ static int extract_ip(DBusMessageIter *array, int family,
 {
 	DBusMessageIter dict;
 	char *address = NULL, *gateway = NULL, *netmask = NULL, *peer = NULL;
-	unsigned char prefix_len;
+	unsigned char prefix_len = 128;

 	if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_ARRAY)
 		return -EINVAL;
--
2.39.5