dhcp: fix nm_dhcp_lease_data_parse_cstr() to correctly detect NUL chars

Fixes: 784932550c ('dhcp/nettools: validate and normalize Host Name Option (12)')
(cherry picked from commit 881b42c454)
This commit is contained in:
Thomas Haller 2021-05-27 09:43:25 +02:00
parent 03914cbf2d
commit 0b8cf38b68
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -880,7 +880,7 @@ nm_dhcp_lease_data_parse_cstr(const guint8 *data, gsize n_data, gsize *out_new_l
n_data--;
if (n_data > 0) {
if (memchr(data, n_data, '\0')) {
if (memchr(data, '\0', n_data)) {
/* we accept trailing NUL, but none in between.
*
* https://tools.ietf.org/html/rfc2132#section-2