Skip to content

Commit a910b98

Browse files
committed
Fixed crash if trying to dump a packet larger than USB_PACKET_LENGTH
1 parent 04da47f commit a910b98

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/joystick/hidapi/SDL_hidapijoystick.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void HIDAPI_DumpPacket(const char *prefix, const Uint8 *data, int size)
117117
{
118118
int i;
119119
char *buffer;
120-
size_t length = SDL_strlen(prefix) + 11 * (USB_PACKET_LENGTH / 8) + (5 * USB_PACKET_LENGTH * 2) + 1 + 1;
120+
size_t length = SDL_strlen(prefix) + 11 * (size / 8) + (5 * size * 2) + 1 + 1;
121121
int start = 0, amount = size;
122122
size_t current_len;
123123

0 commit comments

Comments
 (0)