Blob Blame History Raw
From 5378d7929eac07d55d5aa128ed21d6c03b14acf2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Mon, 2 Jun 2014 14:32:18 +0200
Subject: [PATCH 1/2] tui: fix a crash when editing an IPv6 address (rh
 #1103702)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

https://bugzilla.redhat.com/show_bug.cgi?id=1103702

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
 tui/nm-editor-bindings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tui/nm-editor-bindings.c b/tui/nm-editor-bindings.c
index 44c9ec9..58346cd 100644
--- a/tui/nm-editor-bindings.c
+++ b/tui/nm-editor-bindings.c
@@ -671,7 +671,7 @@ ip6_addresses_with_prefix_from_strv (GBinding     *binding,
 	              NULL);
 
 	for (i = 0; strings[i]; i++) {
-		if (i > addrs->len) {
+		if (i >= addrs->len) {
 			addr = g_value_array_new (3);
 
 			g_value_init (&val, DBUS_TYPE_G_UCHAR_ARRAY);
-- 
1.7.11.7


From d7b8aeea335498771bc66faae0cbd938b02ce84a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Mon, 2 Jun 2014 14:36:16 +0200
Subject: [PATCH 2/2] tui: use 128 as the default prefix for IPv6 addresses
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit


Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
 tui/nm-editor-bindings.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tui/nm-editor-bindings.c b/tui/nm-editor-bindings.c
index 58346cd..7f76f14 100644
--- a/tui/nm-editor-bindings.c
+++ b/tui/nm-editor-bindings.c
@@ -104,8 +104,12 @@ ip_string_parse (const char *text,
 		    || (family == AF_INET && *prefix > 32)
 		    || (family == AF_INET6 && *prefix > 128))
 			valid = FALSE;
-	} else if (prefix)
-		*prefix = 32;
+	} else if (prefix) {
+		if (family == AF_INET)
+			*prefix = 32;
+		else
+			*prefix = 128;
+	}
 
 	return valid;
 }
-- 
1.7.11.7