From e627b3fc865df1ffc573dfe33d0ebe864f8beea4 Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Tue, 17 Dec 2024 17:06:08 +0100 Subject: [PATCH] Fix with string termination. Signed-off-by: Pol Henarejos --- src/fs/phy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fs/phy.c b/src/fs/phy.c index 4e88272..173a72a 100644 --- a/src/fs/phy.c +++ b/src/fs/phy.c @@ -53,6 +53,7 @@ int phy_serialize_data(const phy_data_t *phy, uint8_t *data, uint16_t *len) { *p++ = PHY_USB_PRODUCT; strcpy((char *)p, phy->usb_product); p += strlen(phy->usb_product); + *p++ = '\0'; } *len = p - data; @@ -95,7 +96,7 @@ int phy_unserialize_data(const uint8_t *data, uint16_t len, phy_data_t *phy) { memset(phy->usb_product, 0, sizeof(phy->usb_product)); strlcpy(phy->usb_product, (const char *)p, sizeof(phy->usb_product)); phy->usb_product_present = true; - p += strlen(phy->usb_product); + p += strlen(phy->usb_product) + 1; break; } }