From 0b8cf38b688c5301524d8b118181bfe6c8797e2f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 27 May 2021 09:43:25 +0200 Subject: [PATCH] dhcp: fix nm_dhcp_lease_data_parse_cstr() to correctly detect NUL chars Fixes: 784932550ce1 ('dhcp/nettools: validate and normalize Host Name Option (12)') (cherry picked from commit 881b42c45489a68eaad83968ba031f1236ac0d16) --- src/core/dhcp/nm-dhcp-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/dhcp/nm-dhcp-utils.c b/src/core/dhcp/nm-dhcp-utils.c index 646411e201..63d90641d6 100644 --- a/src/core/dhcp/nm-dhcp-utils.c +++ b/src/core/dhcp/nm-dhcp-utils.c @@ -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