From 5b5b651bcfd3446c5c4e91b475f707e529e0d966 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 12 Aug 2018 16:39:38 +0200 Subject: [PATCH] dhcp/trivial: add fixme comments to nm_dhcp_dhclient_unescape_duid() --- src/dhcp/nm-dhcp-dhclient-utils.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/dhcp/nm-dhcp-dhclient-utils.c b/src/dhcp/nm-dhcp-dhclient-utils.c index 16d60c35a2..d8f8dd98d8 100644 --- a/src/dhcp/nm-dhcp-dhclient-utils.c +++ b/src/dhcp/nm-dhcp-dhclient-utils.c @@ -530,6 +530,10 @@ nm_dhcp_dhclient_unescape_duid (const char *duid) guint i, len; guint8 octal; + /* FIXME: it's wrong to have an "unescape-duid" function. dhclient + * defines a file format with escaping. So we need a general unescape + * function that can handle dhclient syntax. */ + len = strlen (duid); unescaped = g_byte_array_sized_new (len); for (i = 0; i < len; i++) { @@ -543,6 +547,9 @@ nm_dhcp_dhclient_unescape_duid (const char *duid) g_byte_array_append (unescaped, &octal, 1); i += 2; } else { + /* FIXME: don't warn on untrusted data. Either signal an error, or accept + * it silently. */ + /* One of ", ', $, `, \, |, or & */ g_warn_if_fail (p[i] == '"' || p[i] == '\'' || p[i] == '$' || p[i] == '`' || p[i] == '\\' || p[i] == '|' ||