wacom-usb: Fix a false positive in real world firmware

Some files have a newline inbetween the AB sections.
This commit is contained in:
Richard Hughes 2021-09-14 13:25:10 +01:00
parent 5d4e70e9cc
commit 6817648c6b

View File

@ -52,10 +52,15 @@ fu_wac_firmware_parse(FuFirmware *firmware,
/* parse each line */
lines = fu_common_strnsplit((const gchar *)data, len, "\n", -1);
for (guint i = 0; lines[i] != NULL; i++) {
g_autofree gchar *cmd = g_strndup(lines[i], 2);
g_autofree gchar *cmd = NULL;
/* remove windows line endings */
g_strdelimit(lines[i], "\r", '\0');
cmd = g_strndup(lines[i], 2);
/* ignore blank lines */
if (g_strcmp0(cmd, "") == 0)
continue;
/* Wacom-specific metadata */
if (g_strcmp0(cmd, "WA") == 0) {
@ -191,7 +196,8 @@ fu_wac_firmware_parse(FuFirmware *firmware,
g_set_error(error,
FWUPD_ERROR,
FWUPD_ERROR_INTERNAL,
"invalid SREC command: %s",
"invalid SREC command on line %u: %s",
i + 1,
cmd);
return FALSE;
}