From efca0b8fa640a8490c43cef9b03fd92b6c149180 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 24 Jun 2022 12:53:05 +0200 Subject: [PATCH] ifcfg-rh: in get_route_attributes_string() check prefix for "lock" names In practice, the profile probably validates, so all the attribute names are well-known. There is thus no attribute name that has "lock-" in the middle of the string. Still, fix it. We want to match only at the begin of the name. --- src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index d3ca409cd8..c0e97afe96 100644 --- a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -2335,7 +2335,7 @@ get_route_attributes_string(NMIPRoute *route, int family) names[i], (lock && g_variant_get_boolean(lock)) ? "lock " : "", g_variant_get_uint32(attr)); - } else if (strstr(names[i], "lock-")) { + } else if (NM_STR_HAS_PREFIX(names[i], "lock-")) { const char *n = &(names[i])[NM_STRLEN("lock-")]; attr = nm_ip_route_get_attribute(route, n);