libnm: fix unterminated NUL string when parsing UDev properties

This can result in trailing garbage (which fails UTF-8 validation
checks) or even worse, in read-out-of-bounds.

Fixes: 6808bf8195

https://bugzilla.redhat.com/show_bug.cgi?id=1443114
https://bugzilla.redhat.com/show_bug.cgi?id=1451160
https://bugzilla.redhat.com/show_bug.cgi?id=1451286
This commit is contained in:
Thomas Haller
2017-05-17 16:45:46 +02:00
parent 41e7fca597
commit 9594ee6e69

View File

@@ -89,6 +89,7 @@ nm_udev_utils_property_decode (const char *uproperty, char **to_free)
return uproperty; return uproperty;
} }
*n++ = '\0';
return (*to_free = unescaped); return (*to_free = unescaped);
} }