From c15eae92c0c5fc12017dd84a66ee0bbb9638b270 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 17 May 2017 17:04:13 +0200 Subject: libnm: don't cunescape \x00 encoding in nm_udev_utils_property_decode() UDev never creates such invalid escape sequences. Anyway, we cannot accept a NUL character at this point. Just take the ill escape verbatim -- it should never happen anyway. --- shared/nm-utils/nm-udev-utils.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shared/nm-utils/nm-udev-utils.c b/shared/nm-utils/nm-udev-utils.c index 1f1811cd9b..79d4426de9 100644 --- a/shared/nm-utils/nm-udev-utils.c +++ b/shared/nm-utils/nm-udev-utils.c @@ -67,8 +67,9 @@ nm_udev_utils_property_decode (const char *uproperty, char **to_free) if ( p[0] == '\\' && p[1] == 'x' && (a = g_ascii_xdigit_value (p[2])) >= 0 - && (b = g_ascii_xdigit_value (p[3])) >= 0) { - if (!unescaped) { + && (b = g_ascii_xdigit_value (p[3])) >= 0 + && (a || b)) { + if (!n) { gssize l = p - uproperty; unescaped = g_malloc (l + strlen (p) + 1 - 3); @@ -84,7 +85,7 @@ nm_udev_utils_property_decode (const char *uproperty, char **to_free) } } - if (!unescaped) { + if (!n) { *to_free = NULL; return uproperty; } -- cgit v1.2.1