diff --git a/right/src/usb_commands/usb_command_exec_macro_command.c b/right/src/usb_commands/usb_command_exec_macro_command.c index f1c81cfd..682756f1 100644 --- a/right/src/usb_commands/usb_command_exec_macro_command.c +++ b/right/src/usb_commands/usb_command_exec_macro_command.c @@ -16,7 +16,7 @@ key_state_t dummyState; static void requestExecution(const uint8_t *GenericHidOutBuffer) { - Utils_SafeStrCopy(UsbMacroCommand, ((char*)GenericHidOutBuffer) + 1, sizeof(GenericHidOutBuffer)-1); + Utils_SafeStrCopy(UsbMacroCommand, ((char*)GenericHidOutBuffer) + 1, USB_GENERIC_HID_OUT_BUFFER_LENGTH - 1); UsbMacroCommandLength = strlen(UsbMacroCommand); EventVector_Set(EventVector_UsbMacroCommandWaitingForExecution); diff --git a/right/src/usb_commands/usb_command_get_device_property.c b/right/src/usb_commands/usb_command_get_device_property.c index 7b780c9f..4627e627 100644 --- a/right/src/usb_commands/usb_command_get_device_property.c +++ b/right/src/usb_commands/usb_command_get_device_property.c @@ -67,11 +67,11 @@ void UsbCommand_GetDeviceProperty(const uint8_t *GenericHidOutBuffer, uint8_t *G SetUsbTxBufferUint32(1, CurrentTime); break; case DevicePropertyId_GitTag: - Utils_SafeStrCopy(((char *)GenericHidInBuffer) + 1, gitTag, sizeof(GenericHidInBuffer) - 1); + Utils_SafeStrCopy(((char *)GenericHidInBuffer) + 1, gitTag, USB_GENERIC_HID_IN_BUFFER_LENGTH - 1); break; case DevicePropertyId_GitRepo: Utils_SafeStrCopy( - ((char *)GenericHidInBuffer) + 1, gitRepo, sizeof(GenericHidInBuffer) - 1); + ((char *)GenericHidInBuffer) + 1, gitRepo, USB_GENERIC_HID_IN_BUFFER_LENGTH - 1); break; case DevicePropertyId_FirmwareChecksum: { uint8_t moduleId = GetUsbRxBufferUint8(2); diff --git a/right/src/usb_commands/usb_command_get_module_property.c b/right/src/usb_commands/usb_command_get_module_property.c index 5b5efdaa..13a2f890 100644 --- a/right/src/usb_commands/usb_command_get_module_property.c +++ b/right/src/usb_commands/usb_command_get_module_property.c @@ -31,13 +31,13 @@ void UsbCommand_GetModuleProperty(const uint8_t *GenericHidOutBuffer, uint8_t *G case ModulePropertyId_GitTag: { uint8_t moduleDriverId = UhkModuleSlaveDriver_SlotIdToDriverId(slotId); uhk_module_state_t *moduleState = UhkModuleStates + moduleDriverId; - Utils_SafeStrCopy(((char*)GenericHidInBuffer) + 1, moduleState->gitTag, sizeof(GenericHidInBuffer) - 1); + Utils_SafeStrCopy(((char*)GenericHidInBuffer) + 1, moduleState->gitTag, USB_GENERIC_HID_IN_BUFFER_LENGTH - 1); break; } case ModulePropertyId_GitRepo: { uint8_t moduleDriverId = UhkModuleSlaveDriver_SlotIdToDriverId(slotId); uhk_module_state_t *moduleState = UhkModuleStates + moduleDriverId; - Utils_SafeStrCopy(((char*)GenericHidInBuffer) + 1, moduleState->gitRepo, sizeof(GenericHidInBuffer) - 1); + Utils_SafeStrCopy(((char*)GenericHidInBuffer) + 1, moduleState->gitRepo, USB_GENERIC_HID_IN_BUFFER_LENGTH - 1); break; } case ModulePropertyId_FirmwareChecksum: { diff --git a/right/src/usb_commands/usb_command_get_variable.c b/right/src/usb_commands/usb_command_get_variable.c index 95391bd9..7fec616e 100644 --- a/right/src/usb_commands/usb_command_get_variable.c +++ b/right/src/usb_commands/usb_command_get_variable.c @@ -5,6 +5,7 @@ #include "usb_report_updater.h" #include "macros/core.h" #include "config_manager.h" +#include "usb_interfaces/usb_interface_generic_hid.h" void UsbCommand_GetVariable(const uint8_t *GenericHidOutBuffer, uint8_t *GenericHidInBuffer) { @@ -27,7 +28,7 @@ void UsbCommand_GetVariable(const uint8_t *GenericHidOutBuffer, uint8_t *Generic SetUsbTxBufferUint8(1, UsbReportUpdateSemaphore); break; case UsbVariable_StatusBuffer: - for (uint8_t i = 1; i < sizeof(GenericHidInBuffer); i++) { + for (uint8_t i = 1; i < USB_GENERIC_HID_IN_BUFFER_LENGTH; i++) { char c = Macros_ConsumeStatusChar(); SetUsbTxBufferUint8(i, c); if (c == '\0') {