mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-09-10 13:00:08 +00:00
realtek: Fail on shorter data read that may lead to an underflow
Reported by: Keith Linneman (LinnemanLabs)
This commit is contained in:
committed by
Marco Trevisan
parent
2e2ba8b227
commit
07152e43ef
@@ -638,6 +638,14 @@ fp_cmd_receive_cb (FpiUsbTransfer *transfer,
|
||||
{
|
||||
g_autofree guchar *read_buf = NULL;
|
||||
|
||||
if ((gsize) transfer->actual_length < self->trans_data_len)
|
||||
{
|
||||
fpi_ssm_mark_failed (transfer->ssm,
|
||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
||||
"Truncated data received"));
|
||||
return;
|
||||
}
|
||||
|
||||
read_buf = g_malloc0 (sizeof (guchar) * (self->trans_data_len));
|
||||
memcpy (read_buf, transfer->buffer, self->trans_data_len);
|
||||
self->read_data = g_steal_pointer (&read_buf);
|
||||
|
||||
Reference in New Issue
Block a user