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.
This commit is contained in:
Thomas Haller 2017-05-17 17:04:13 +02:00
parent 9594ee6e69
commit c15eae92c0

View file

@ -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;
}