From e7cf5d94ba3997ae5d5fc99ce776d0d49e67527e Mon Sep 17 00:00:00 2001 From: KrahJohlito Date: Thu, 5 Sep 2024 19:04:41 +0930 Subject: [PATCH] bdmsupport.c: fix overflow --- src/bdmsupport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bdmsupport.c b/src/bdmsupport.c index 5ea48871c..2a68e4d33 100644 --- a/src/bdmsupport.c +++ b/src/bdmsupport.c @@ -582,14 +582,14 @@ static void bdmCleanUp(item_list_t *itemList, int exception) // This may be called, even if bdmInit() was not. static void bdmShutdown(item_list_t *itemList) { - char path[10] = {0}; + char path[16]; LOG("BDMSUPPORT Shutdown\n"); // Format the device path. // Getting the device number is only relevant per module ie usb0 and mx40 will result in both being massDeviceIndex = 0 or mass0, use mode to determine instead. bdm_device_data_t *pDeviceData = (bdm_device_data_t *)itemList->priv; - sprintf(path, "mass%d:", itemList->mode); + snprintf(path, sizeof(path), "mass%d:", itemList->mode); // As required by some (typically 2.5") HDDs, issue the SCSI STOP UNIT command to avoid causing an emergency park. fileXioDevctl(path, USBMASS_DEVCTL_STOP_ALL, NULL, 0, NULL, 0);