about summary refs log tree commit diff
path: root/src/dhcp/nm-dhcp-utils.c
diff options
context:
space:
mode:
authorJeremy Bicha <jbicha@ubuntu.com>2018-02-08 17:55:49 -0500
committerJeremy Bicha <jbicha@ubuntu.com>2018-02-08 17:55:49 -0500
commitf1c906035c6ea7eb635664835c153aed553dc2e5 (patch)
tree7b870b6cef1f902486dc706084124c6964b342a6 /src/dhcp/nm-dhcp-utils.c
parentd6158994abe7b2be73443f933ed7fdcc40954c24 (diff)
parentd0408a3e3b1cc6effec321d098008ef0c4acf91b (diff)
Merge tag 'debian/1.10.4-1' into bionic
network-manager Debian release 1.10.4-1
Diffstat (limited to 'src/dhcp/nm-dhcp-utils.c')
-rw-r--r--src/dhcp/nm-dhcp-utils.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dhcp/nm-dhcp-utils.c b/src/dhcp/nm-dhcp-utils.c
index 4b2d57b9..50ca2abe 100644
--- a/src/dhcp/nm-dhcp-utils.c
+++ b/src/dhcp/nm-dhcp-utils.c
@@ -750,8 +750,15 @@ nm_dhcp_utils_client_id_string_to_bytes (const char *client_id)
 	g_return_val_if_fail (client_id && client_id[0], NULL);
 
 	/* Try as hex encoded */
-	if (strchr (client_id, ':'))
+	if (strchr (client_id, ':')) {
 		bytes = nm_utils_hexstr2bin (client_id);
+
+		/* the result must be at least two bytes long,
+		 * because @client_id contains a delimiter
+		 * but nm_utils_hexstr2bin() does not allow
+		 * leading nor trailing delimiters. */
+		nm_assert (!bytes || g_bytes_get_size (bytes) >= 2);
+	}
 	if (!bytes) {
 		/* Fall back to string */
 		len = strlen (client_id);