diff --git a/Controllers/ArcticController/ArcticController.cpp b/Controllers/ArcticController/ArcticController.cpp index 32693ccf5..e03deed64 100644 --- a/Controllers/ArcticController/ArcticController.cpp +++ b/Controllers/ArcticController/ArcticController.cpp @@ -68,7 +68,8 @@ static void FormatCommandBuffer(char *buffer, char command) void ArcticController::SetChannels(std::vector colors) { - char* buffer = new char[ARCTIC_COMMAND_BUFFER_LENGTH(colors.size() * 3)]; + size_t buffer_length = ARCTIC_COMMAND_BUFFER_LENGTH(colors.size() * 3); + char* buffer = new char[buffer_length]; FormatCommandBuffer(buffer, ARCTIC_COMMAND_SET_RGB); @@ -81,7 +82,7 @@ void ArcticController::SetChannels(std::vector colors) buffer[offset + 0x02] = (char)std::min(254, RGBGetBValue(colors[channel])); } - serialport.serial_write(buffer, sizeof(buffer)); + serialport.serial_write(buffer, buffer_length); delete[] buffer; }