From 4e463df100c2963c77d64a7b85e3a335baf988d6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 22 May 2018 20:03:44 +0200 Subject: [PATCH] libnm: allow nm_utils_hwaddr_valid() of length zero nm_utils_hwaddr_valid() is used for validating strings. It should not assert against calling it with an empty string "". That is just an invalid hwaddr. --- libnm-core/nm-utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index a6d6486fac..a7b896314f 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -3827,9 +3827,11 @@ nm_utils_hwaddr_valid (const char *asc, gssize length) if (!hwaddr_aton (asc, buf, length, &l)) return FALSE; return length == l; - } else if (length == -1) { + } else if (length == -1) return !!hwaddr_aton (asc, buf, sizeof (buf), &l); - } else + else if (length == 0) + return FALSE; + else g_return_val_if_reached (FALSE); }