From a9e64ee3a4ed4d750a167d341d1481b984c41849 Mon Sep 17 00:00:00 2001 From: Old-Ding <35417409+Old-Ding@users.noreply.github.com> Date: Sun, 28 Jun 2026 15:40:08 +0800 Subject: [PATCH] Fix RT-Thread MSC inquiry string bounds --- lib/rt-thread/port/msc_device_port.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rt-thread/port/msc_device_port.c b/lib/rt-thread/port/msc_device_port.c index c7e8c508e..d981759c4 100644 --- a/lib/rt-thread/port/msc_device_port.c +++ b/lib/rt-thread/port/msc_device_port.c @@ -49,9 +49,9 @@ void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16 const char pid[] = PKG_TINYUSB_DEVICE_MSC_PID; const char rev[] = PKG_TINYUSB_DEVICE_MSC_REV; - memcpy(vendor_id, vid, strlen(vid)); - memcpy(product_id, pid, strlen(pid)); - memcpy(product_rev, rev, strlen(rev)); + strncpy((char*) vendor_id, vid, 8); + strncpy((char*) product_id, pid, 16); + strncpy((char*) product_rev, rev, 4); } bool tud_msc_test_unit_ready_cb(uint8_t lun)