From 09a3d3328ea4c204f55f5e9bfe83e4826bdd0405 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 19 Mar 2019 09:27:30 -0700 Subject: Fix off-by-one error in code for loading an SMD format ROM from a ZIP archive --- blastem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'blastem.c') diff --git a/blastem.c b/blastem.c index d5dcf7c..a80e99e 100644 --- a/blastem.c +++ b/blastem.c @@ -154,7 +154,7 @@ uint32_t load_rom_zip(const char *filename, void **dst) 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); -- cgit v1.2.3