SDL: Fixed crash if trying to dump a packet larger than USB_PACKET_LENGTH

From b252ecec6d139e236b4b7cce99076acdf89f3151 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 25 May 2023 09:53:40 -0700
Subject: [PATCH] Fixed crash if trying to dump a packet larger than
 USB_PACKET_LENGTH

---
 src/joystick/hidapi/SDL_hidapijoystick.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c
index 393524dbdd97..daea81cd56c7 100644
--- a/src/joystick/hidapi/SDL_hidapijoystick.c
+++ b/src/joystick/hidapi/SDL_hidapijoystick.c
@@ -117,7 +117,7 @@ void HIDAPI_DumpPacket(const char *prefix, const Uint8 *data, int size)
 {
     int i;
     char *buffer;
-    size_t length = SDL_strlen(prefix) + 11 * (USB_PACKET_LENGTH / 8) + (5 * USB_PACKET_LENGTH * 2) + 1 + 1;
+    size_t length = SDL_strlen(prefix) + 11 * (size / 8) + (5 * size * 2) + 1 + 1;
     int start = 0, amount = size;
     size_t current_len;