From a754f93ff83fe0ce03a0ebce6c0b1485cf11dffc Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 22 Feb 2023 21:14:22 +0000 Subject: [PATCH] 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 --- libfwupdplugin/fu-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfwupdplugin/fu-common.c b/libfwupdplugin/fu-common.c index ee47dd04d..51c94c2b5 100644 --- a/libfwupdplugin/fu-common.c +++ b/libfwupdplugin/fu-common.c @@ -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++) {