changeset 1788:154c7b348cf1

Fix off-by-one error in code for loading an SMD format ROM from a ZIP archive
author Michael Pavone <pavone@retrodev.com>
date Tue, 19 Mar 2019 09:27:30 -0700
parents 2b661c1e431f
children b3eb74936f18
files blastem.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/blastem.c	Thu Mar 14 23:27:10 2019 -0700
+++ b/blastem.c	Tue Mar 19 09:27:30 2019 -0700
@@ -154,7 +154,7 @@
 				if (*dst) {
 					if (is_smd_format(z->entries[i].name, *dst)) {
 						size_t offset;
-						for (offset = 0; offset + SMD_BLOCK_SIZE + SMD_HEADER_SIZE < out_size; offset += SMD_BLOCK_SIZE)
+						for (offset = 0; offset + SMD_BLOCK_SIZE + SMD_HEADER_SIZE <= out_size; offset += SMD_BLOCK_SIZE)
 						{
 							uint8_t tmp[SMD_BLOCK_SIZE];
 							memcpy(tmp, *dst + offset + SMD_HEADER_SIZE, SMD_BLOCK_SIZE);