mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 18:49:10 +00:00
ihex: Fix a buffer-overread spotted by AddressSanitizer
This commit is contained in:
parent
abdc82b1c1
commit
6920eb1214
@ -90,11 +90,6 @@ fu_ihex_firmware_record_new (guint ln, const gchar *line,
|
|||||||
rcd->ln = ln;
|
rcd->ln = ln;
|
||||||
rcd->data = g_byte_array_new ();
|
rcd->data = g_byte_array_new ();
|
||||||
rcd->buf = g_string_new (line);
|
rcd->buf = g_string_new (line);
|
||||||
rcd->byte_cnt = fu_firmware_strparse_uint8 (line + 1);
|
|
||||||
rcd->addr = fu_firmware_strparse_uint16 (line + 3);
|
|
||||||
rcd->record_type = fu_firmware_strparse_uint8 (line + 7);
|
|
||||||
|
|
||||||
/* check there's enough data for the smallest possible record */
|
|
||||||
if (rcd->buf->len < 11) {
|
if (rcd->buf->len < 11) {
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
FWUPD_ERROR,
|
FWUPD_ERROR,
|
||||||
@ -103,6 +98,9 @@ fu_ihex_firmware_record_new (guint ln, const gchar *line,
|
|||||||
(guint) rcd->buf->len);
|
(guint) rcd->buf->len);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
rcd->byte_cnt = fu_firmware_strparse_uint8 (line + 1);
|
||||||
|
rcd->addr = fu_firmware_strparse_uint16 (line + 3);
|
||||||
|
rcd->record_type = fu_firmware_strparse_uint8 (line + 7);
|
||||||
|
|
||||||
/* position of checksum */
|
/* position of checksum */
|
||||||
line_end = 9 + rcd->byte_cnt * 2;
|
line_end = 9 + rcd->byte_cnt * 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user