acpi-phat: Fix a critical warning when parsing an invalid PHAT record

See https://oss-fuzz.com/testcase-detail/6099569951244288 for details.
This commit is contained in:
Richard Hughes 2022-07-13 09:12:25 +01:00
parent 060e40b16c
commit 2fbadaa95f

View File

@ -103,7 +103,7 @@ fu_acpi_phat_health_record_parse(FuFirmware *firmware,
}
/* check this is an even number of bytes */
if (ubufsz % 2 != 0) {
if (ubufsz == 0 || ubufsz % 2 != 0) {
g_set_error(error,
G_IO_ERROR,
G_IO_ERROR_INVALID_DATA,