33 lines
974 B
Diff
33 lines
974 B
Diff
|
From fa2b8fdbdfabaee292cf63adcc53ae026e6afbe3 Mon Sep 17 00:00:00 2001
|
||
|
From: Thomas Haller <thaller@redhat.com>
|
||
|
Date: Wed, 22 Jul 2015 13:06:29 +0200
|
||
|
Subject: [PATCH 08/11] libnm-core: properly handle %NULL @ip in
|
||
|
nm_utils_ipaddr_valid()
|
||
|
|
||
|
A is_valid() function should just accept NULL as input and
|
||
|
return "invalid". It certainly should not crash.
|
||
|
|
||
|
Fixes: 21c8a6b20effbe1e689505a0cbb23594be06068c
|
||
|
(cherry picked from commit 2b55de856027657e567914361f501bbfbca050b4)
|
||
|
---
|
||
|
libnm-core/nm-utils.c | 3 +++
|
||
|
1 file changed, 3 insertions(+)
|
||
|
|
||
|
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
|
||
|
index 6a7ed61..3fb8676 100644
|
||
|
--- a/libnm-core/nm-utils.c
|
||
|
+++ b/libnm-core/nm-utils.c
|
||
|
@@ -3353,6 +3353,9 @@ nm_utils_ipaddr_valid (int family, const char *ip)
|
||
|
|
||
|
g_return_val_if_fail (family == AF_INET || family == AF_INET6 || family == AF_UNSPEC, FALSE);
|
||
|
|
||
|
+ if (!ip)
|
||
|
+ return FALSE;
|
||
|
+
|
||
|
if (family == AF_UNSPEC)
|
||
|
family = strchr (ip, ':') ? AF_INET6 : AF_INET;
|
||
|
|
||
|
--
|
||
|
2.4.3
|
||
|
|