diff options
author | Thomas Haller <thaller@redhat.com> | 2017-05-17 17:04:13 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-05-19 09:46:08 +0200 |
commit | c15eae92c0c5fc12017dd84a66ee0bbb9638b270 (patch) | |
tree | 3ddb4a6afb8994a403245c0422a8c0b8ec1bbd70 | |
parent | 9594ee6e6921c3e37615a572de7e986274a68500 (diff) | |
download | NetworkManager-c15eae92c0c5fc12017dd84a66ee0bbb9638b270.tar.gz |
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.
-rw-r--r-- | shared/nm-utils/nm-udev-utils.c | 7 |
1 files 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; } |