Fix a critical warning when parsing an empty kernel cmdline

Fix the bounds check so we never pass a bufsz of zero to fu_strsplit().

Resolves: https://github.com/fwupd/fwupd/issues/5575
This commit is contained in:
Richard Hughes 2023-02-22 21:14:22 +00:00 committed by Mario Limonciello
parent 2819653a3a
commit c6fa4e97e7

View File

@ -116,7 +116,7 @@ fu_common_is_live_media(void)
return TRUE;
if (!g_file_get_contents("/proc/cmdline", &buf, &bufsz, NULL))
return FALSE;
if (bufsz == 0)
if (bufsz <= 1)
return FALSE;
tokens = fu_strsplit(buf, bufsz - 1, " ", -1);
for (guint i = 0; args[i] != NULL; i++) {