trivial: fu-engine: skip empty cmdline commands

g_strsplit returns an empty vector for an empty string,
which leads to assertion in g_strv_contains when /proc/cmdline
ends with a space.
This commit is contained in:
Jan Tojnar 2020-11-07 16:57:12 +01:00 committed by Richard Hughes
parent 01ba0c1eea
commit a8b3f9ed57

View File

@ -1620,7 +1620,10 @@ fu_engine_get_report_metadata_kernel_cmdline (GHashTable *hash, GError **error)
g_auto(GStrv) tokens = fu_common_strnsplit (buf, bufsz - 1, " ", -1);
g_autoptr(GString) cmdline_safe = g_string_new (NULL);
for (guint i = 0; tokens[i] != NULL; i++) {
g_auto(GStrv) kv = g_strsplit (tokens[i], "=", 2);
g_auto(GStrv) kv = NULL;
if (strlen (tokens[i]) == 0)
continue;
kv = g_strsplit (tokens[i], "=", 2);
if (g_strv_contains (ignore, kv[0]))
continue;
if (cmdline_safe->len > 0)