From d42477ebc5d7599fd0684470f5436577342fe3f2 Mon Sep 17 00:00:00 2001 From: Roland Ruckerbauer Date: Mon, 25 Nov 2019 23:03:20 +0100 Subject: [PATCH] Fix infinite loop in jtagtap_tdi_tdo_seq --- src/platforms/pc-hosted/jtagtap.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/platforms/pc-hosted/jtagtap.c b/src/platforms/pc-hosted/jtagtap.c index 0bac576..fee3f13 100644 --- a/src/platforms/pc-hosted/jtagtap.c +++ b/src/platforms/pc-hosted/jtagtap.c @@ -112,12 +112,14 @@ void jtagtap_tdi_tdo_seq(uint8_t *DO, const uint8_t final_tms, const uint8_t *DI } if (DO) { - int i = 1; - while (ticks) { - *DO = (uint8_t)remotehston(2,(char *)&construct[i]); - DO++; - i += 2; - } + uint64_t Dol; + int i = 8; + while (ticks > 0) { + Dol = remotehston(8 , (char *)&construct[s - i]); + memcpy (DO, &Dol, (ticks + 7) / 8); + ticks -= 64; + i += 8; + } } }