Fixed invalid buffer length and duplicated write function.

This commit is contained in:
akallabeth 2020-07-09 12:20:48 +02:00 committed by Armin Novak
parent e7533130a6
commit 54c92e78e6
3 changed files with 7 additions and 6 deletions

View File

@ -763,9 +763,7 @@ static void urb_isoch_transfer_cb(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callb
Stream_Write_UINT32(out, OutputBufferSize); /** OutputBufferSize */ Stream_Write_UINT32(out, OutputBufferSize); /** OutputBufferSize */
Stream_Seek(out, OutputBufferSize); Stream_Seek(out, OutputBufferSize);
if (!pdev->isChannelClosed(pdev)) stream_write_and_free(callback->plugin, callback->channel, out);
callback->channel->Write(callback->channel, Stream_GetPosition(out), Stream_Buffer(out),
NULL);
} }
} }

View File

@ -923,7 +923,10 @@ static int libusb_udev_os_feature_descriptor_request(IUDEVICE* idev, UINT32 Requ
LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | Recipient, LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | Recipient,
bMS_Vendorcode, (InterfaceNumber << 8) | Ms_PageIndex, bMS_Vendorcode, (InterfaceNumber << 8) | Ms_PageIndex,
Ms_featureDescIndex, Buffer, *BufferSize, Timeout); Ms_featureDescIndex, Buffer, *BufferSize, Timeout);
*BufferSize = error; log_libusb_result(pdev->urbdrc->log, WLOG_DEBUG, "libusb_control_transfer", error);
if (error >= 0)
*BufferSize = error;
} }
if (error < 0) if (error < 0)

View File

@ -391,7 +391,7 @@ void urbdrc_dump_message(wLog* log, BOOL client, BOOL write, wStream* s)
pos = Stream_GetPosition(s); pos = Stream_GetPosition(s);
if (write) if (write)
{ {
length = Stream_GetPosition(s); length = pos;
Stream_SetPosition(s, 0); Stream_SetPosition(s, 0);
} }
else else
@ -407,7 +407,7 @@ void urbdrc_dump_message(wLog* log, BOOL client, BOOL write, wStream* s)
WLog_Print(log, WLOG_DEBUG, WLog_Print(log, WLOG_DEBUG,
"[%-5s] %s [%08" PRIx32 "] InterfaceId=%08" PRIx32 ", MessageId=%08" PRIx32 "[%-5s] %s [%08" PRIx32 "] InterfaceId=%08" PRIx32 ", MessageId=%08" PRIx32
", FunctionId=%08" PRIx32 ", length=%" PRIdz, ", FunctionId=%08" PRIx32 ", length=%" PRIuz,
type, call_to_string(client, InterfaceId, FunctionId), FunctionId, InterfaceId, type, call_to_string(client, InterfaceId, FunctionId), FunctionId, InterfaceId,
MessageId, FunctionId, length); MessageId, FunctionId, length);
#if defined(WITH_DEBUG_URBDRC) #if defined(WITH_DEBUG_URBDRC)