aboutsummaryrefslogtreecommitdiff
path: root/src/jtag/drivers/jtag_usb_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/jtag/drivers/jtag_usb_common.c')
-rw-r--r--src/jtag/drivers/jtag_usb_common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/jtag/drivers/jtag_usb_common.c b/src/jtag/drivers/jtag_usb_common.c
index f18ea54..fdd7137 100644
--- a/src/jtag/drivers/jtag_usb_common.c
+++ b/src/jtag/drivers/jtag_usb_common.c
@@ -51,7 +51,7 @@ bool jtag_usb_location_equal(uint8_t dev_bus, uint8_t *port_path,
goto done;
}
- string_length -= 1;
+ string_length -= strnlen(ptr, string_length);
/* check bus mismatch */
if (atoi(ptr) != dev_bus)
goto done;
@@ -69,7 +69,7 @@ bool jtag_usb_location_equal(uint8_t dev_bus, uint8_t *port_path,
break;
path_step++;
- string_length -= 2;
+ string_length -= strnlen(ptr, string_length) + 1;
};
/* walked the full path, all elements match */