From 9dd5812a8bdcdb744ecf35aa1badd3dae344b5bc Mon Sep 17 00:00:00 2001 From: "fabio.olimpieri" Date: Wed, 25 Feb 2015 09:29:20 +0000 Subject: [PATCH] Fixed bug in z80 decompressing (case of ED as last byte of the block) --- src/cargador.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/cargador.c b/src/cargador.c index d42e6df..3d8e35e 100644 --- a/src/cargador.c +++ b/src/cargador.c @@ -56,21 +56,18 @@ void uncompress_z80(FILE *fichero,int length,unsigned char *memo) { if(EDfound==2) { // we have two EDs counter=byte_loaded; - retval=fread(&byte_loaded,1,1,fichero); + retval=fread(&byte_loaded,1,1,fichero); //ED byte EDfound=0; continue; } if(byte_loaded==0xED) { - EDfound++; + if (position+1=length) { - break; - } memo[position++]=byte_loaded; } } while(position