fwupd/SOURCES/0008-wacom-usb-Fix-a-crash-detected-by-AddressSanitizer.patch
2021-09-09 16:50:38 +00:00

26 lines
851 B
Diff

From b943adc496451975a9b959d78c0859a7fea5e483 Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Sun, 7 Feb 2021 16:55:02 +0000
Subject: [PATCH 08/11] wacom-usb: Fix a crash detected by AddressSanitizer
---
plugins/wacom-usb/fu-wac-firmware.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git plugins/wacom-usb/fu-wac-firmware.c plugins/wacom-usb/fu-wac-firmware.c
index fc54cf10..d3a41682 100644
--- plugins/wacom-usb/fu-wac-firmware.c
+++ plugins/wacom-usb/fu-wac-firmware.c
@@ -44,7 +44,7 @@ fu_wac_firmware_parse (FuFirmware *firmware,
/* check the prefix (BE) */
data = (guint8 *) g_bytes_get_data (fw, &len);
- if (memcmp (data, "WACOM", 5) != 0) {
+ if (len < 5 || memcmp (data, "WACOM", 5) != 0) {
g_set_error_literal (error,
FWUPD_ERROR,
FWUPD_ERROR_INTERNAL,
--
2.29.2