35 lines
1.3 KiB
Diff
35 lines
1.3 KiB
Diff
From 89b630ff32f9111b3ed518c413b576adbf746e78 Mon Sep 17 00:00:00 2001
|
|
From: Thomas Haller <thaller@redhat.com>
|
|
Date: Wed, 22 Jul 2015 13:05:31 +0200
|
|
Subject: [PATCH 09/11] libnm-core: fix nm-setting-ip-config.c:valid_ip() to
|
|
handle %NULL argument
|
|
|
|
We call valid_ip() from nm_ip_route_new() to check whether an untrusted string
|
|
is a valid ip address. Properly handle %NULL argument.
|
|
|
|
Fixes: 21c8a6b20effbe1e689505a0cbb23594be06068c
|
|
(cherry picked from commit 93425686947127e5bfc2d00521b35c4b75340ee5)
|
|
---
|
|
libnm-core/nm-setting-ip-config.c | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c
|
|
index e6f0401..2e8d0c8 100644
|
|
--- a/libnm-core/nm-setting-ip-config.c
|
|
+++ b/libnm-core/nm-setting-ip-config.c
|
|
@@ -74,6 +74,11 @@ canonicalize_ip (int family, const char *ip, gboolean null_any)
|
|
static gboolean
|
|
valid_ip (int family, const char *ip, GError **error)
|
|
{
|
|
+ if (!ip) {
|
|
+ g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED,
|
|
+ family == AF_INET ? _("Missing IPv4 address") : _("Missing IPv6 address'"));
|
|
+ return FALSE;
|
|
+ }
|
|
if (!nm_utils_ipaddr_valid (family, ip)) {
|
|
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED,
|
|
family == AF_INET ? _("Invalid IPv4 address '%s'") : _("Invalid IPv6 address '%s"),
|
|
--
|
|
2.4.3
|
|
|