From b13ad617ac66f7a87a3a3534d591af5f120b5f89 Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Wed, 14 Jun 2023 12:37:11 +1200 Subject: [PATCH] Fix bugs in OSTC4 support. Fix two bugs in the support for OSTC4: - change block size for writes back to 64 bytes to prevent buffer overflow on the dive computer side; - added 'unsupported' response for the dump command on OSTC4. Signed-off-by: Michael Keller --- src/hw_ostc3.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hw_ostc3.c b/src/hw_ostc3.c index 8f17906..023c978 100644 --- a/src/hw_ostc3.c +++ b/src/hw_ostc3.c @@ -240,7 +240,7 @@ hw_ostc3_write (hw_ostc3_device_t *device, dc_event_progress_t *progress, const size_t nbytes = 0; while (nbytes < size) { // Set the maximum packet size. - size_t length = 1024; + size_t length = 64; // Limit the packet size to the total size. if (nbytes + length > size) @@ -1719,6 +1719,10 @@ hw_ostc3_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) return rc; } + if (device->hardware == OSTC4) { + return DC_STATUS_UNSUPPORTED; + } + // Emit a device info event. dc_event_devinfo_t devinfo; devinfo.firmware = device->firmware;