From 003e4bf9b7de3510180f2a85b8109c89c2b6f821 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 5 Mar 2015 13:28:02 +0000 Subject: [PATCH] Check the firmware is valid for the device before applying --- src/fu-provider-chug.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/fu-provider-chug.c b/src/fu-provider-chug.c index 4bfc26f12..4249c53f8 100644 --- a/src/fu-provider-chug.c +++ b/src/fu-provider-chug.c @@ -217,6 +217,19 @@ fu_provider_chug_update (FuProvider *provider, if (item->fw_bin == NULL) return FALSE; + /* check this firmware is actually for this device */ + if (!ch_device_check_firmware (item->usb_device, + g_bytes_get_data (item->fw_bin, NULL), + g_bytes_get_size (item->fw_bin), + &error_local)) { + g_set_error (error, + FU_ERROR, + FU_ERROR_NOT_POSSIBLE, + "firmware is not suitable: %s", + error_local->message); + return FALSE; + } + /* switch to bootloader mode */ if (!item->is_bootloader) { g_debug ("ColorHug: Switching to bootloader mode");