FreeCalypso > hg > fc-usbser-tools
changeset 56:842cff427588
cp2102: fix Intel HEX read/write bugs
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 11 Sep 2023 19:52:28 +0000 |
parents | c0084bf153e5 |
children | deba1d5c8024 |
files | cp2102/intel_hex_in.c cp2102/intel_hex_out.c |
diffstat | 2 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/cp2102/intel_hex_in.c Mon Sep 11 19:45:56 2023 +0000 +++ b/cp2102/intel_hex_in.c Mon Sep 11 19:52:28 2023 +0000 @@ -80,7 +80,7 @@ record_len = payload_len + 5; cp = linebuf + 1; csum = 0; - for (n = 0; n < payload_len; n++) { + for (n = 0; n < record_len; n++) { if (!isxdigit(cp[0]) || !isxdigit(cp[1])) goto inv_record; record[n] = decode_hex_byte(cp);
--- a/cp2102/intel_hex_out.c Mon Sep 11 19:45:56 2023 +0000 +++ b/cp2102/intel_hex_out.c Mon Sep 11 19:52:28 2023 +0000 @@ -32,7 +32,7 @@ *dp++ = *sp++; csum = 0; for (bytecnt = 0; bytecnt < 20; bytecnt++) - csum = record[bytecnt]; + csum += record[bytecnt]; csum = 0x100 - csum; record[20] = csum; putc(':', outf);