From 7f3bfc9d99fcd8e820dccebe594c61e5d22e4fdb Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Mon, 6 Nov 2017 16:39:30 -0500 Subject: [PATCH] dell: catch invalid dock component requests Test if g_strrstr returns NULL, as this means the string was modified and other requests predicated on this will fail miserably. --- plugins/dell/fu-plugin-dell.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/dell/fu-plugin-dell.c b/plugins/dell/fu-plugin-dell.c index d506755dc..095f61cc2 100644 --- a/plugins/dell/fu-plugin-dell.c +++ b/plugins/dell/fu-plugin-dell.c @@ -439,9 +439,14 @@ fu_plugin_dell_device_added_cb (GUsbContext *ctx, dock_info->components[i].description, dock_info->components[i].fw_version); query_str = g_strrstr (dock_info->components[i].description, - "Query ") + 6; - if (!fu_plugin_dell_match_dock_component (query_str, &guid_raw, - &component_name)) { + "Query "); + if (query_str == NULL) { + g_debug ("Invalid dock component request"); + return; + } + if (!fu_plugin_dell_match_dock_component (query_str + 6, + &guid_raw, + &component_name)) { g_debug ("Unable to match dock component %s", query_str); return;