ao-tools/ao-usbload: Pad image with 0xff instead of random bits
authorKeith Packard <keithp@keithp.com>
Fri, 6 Jan 2017 17:10:23 +0000 (09:10 -0800)
committerKeith Packard <keithp@keithp.com>
Mon, 20 Feb 2017 19:22:21 +0000 (11:22 -0800)
Clear the temporary block to 0xff before copying in the target data so
that any unused bytes end up being left at 0xff instead of inheriting
whatever data was in the block before.

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/lib/ao-selfload.c

index 0a23dfda0ae9eccc1be55b24a90dd8b0ecef7aa7..754cd78413037eb445b08395fc6fd819c4686eb0 100644 (file)
@@ -110,6 +110,7 @@ ao_self_write(struct cc_usb *cc, struct ao_hex_image *image)
                        start = image->address;
                if (stop > image->address + image->length)
                        stop = image->address + image->length;
+               memset(block, 0xff, 0x100);
                memcpy(block + start - address, image->data + start - image->address, stop - start);
                ao_self_block_write(cc, address, block);
                ao_self_block_read(cc, address, check);