mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-07 22:57:14 +00:00
cros-ec: Fix call to fu_memdup_safe in fu_cros_ec_usb_device_do_xfer
outbuf == NULL is a valid condition in fu_cros_ec_usb_device_do_xfer. That's how we use this function to specify a read with no outbound buffer, like the reply at the end of sending a block. Since9b11af985f
("Add fu_memdup_safe()"), however, the call to fu_memdup_safe always fails if outbuf, the dst, is NULL. Fix this by moving this into the if (outbuf != NULL && outlen > 0) block below. Fixes:9b11af985f
("Add fu_memdup_safe()") fixes #3064
This commit is contained in:
parent
f08491f727
commit
3dba442c1f
@ -202,15 +202,16 @@ fu_cros_ec_usb_device_do_xfer (FuCrosEcUsbDevice * self, const guint8 *outbuf,
|
|||||||
{
|
{
|
||||||
GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (self));
|
GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (self));
|
||||||
gsize actual = 0;
|
gsize actual = 0;
|
||||||
g_autofree guint8 *outbuf_tmp = NULL;
|
|
||||||
|
|
||||||
/* make mutable */
|
|
||||||
outbuf_tmp = fu_memdup_safe (outbuf, outlen, error);
|
|
||||||
if (outbuf_tmp == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* send data out */
|
/* send data out */
|
||||||
if (outbuf != NULL && outlen > 0) {
|
if (outbuf != NULL && outlen > 0) {
|
||||||
|
g_autofree guint8 *outbuf_tmp = NULL;
|
||||||
|
|
||||||
|
/* make mutable */
|
||||||
|
outbuf_tmp = fu_memdup_safe (outbuf, outlen, error);
|
||||||
|
if (outbuf_tmp == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (!g_usb_device_bulk_transfer (usb_device, self->ep_num,
|
if (!g_usb_device_bulk_transfer (usb_device, self->ep_num,
|
||||||
outbuf_tmp, outlen,
|
outbuf_tmp, outlen,
|
||||||
&actual, BULK_SEND_TIMEOUT_MS,
|
&actual, BULK_SEND_TIMEOUT_MS,
|
||||||
|
Loading…
Reference in New Issue
Block a user