diff --git a/iguana/iguana_msg.c b/iguana/iguana_msg.c index 01b260cb8..bffba8883 100755 --- a/iguana/iguana_msg.c +++ b/iguana/iguana_msg.c @@ -555,7 +555,9 @@ int32_t iguana_rwvin(int32_t rwflag,struct iguana_info *coin,struct OS_memspace if ( rwflag == 0 ) { msg->scriptlen = tmp; - msg->vinscript = iguana_memalloc(mem,msg->scriptlen,1); + if ( msg->scriptlen < IGUANA_MAXSCRIPTSIZE ) + msg->vinscript = iguana_memalloc(mem,msg->scriptlen,1); + else return(0); } len += iguana_rwmem(rwflag,&serialized[len],msg->scriptlen,msg->vinscript); len += iguana_rwnum(rwflag,&serialized[len],sizeof(msg->sequence),&msg->sequence); @@ -575,7 +577,7 @@ int32_t iguana_rwvout(int32_t rwflag,struct OS_memspace *mem,uint8_t *serialized len += iguana_rwnum(rwflag,&serialized[len],sizeof(msg->value),&msg->value); len += iguana_rwvarint32(rwflag,&serialized[len],&msg->pk_scriptlen); if ( msg->pk_scriptlen > IGUANA_MAXSCRIPTSIZE ) - return(-1); + return(0); if ( rwflag == 0 ) msg->pk_script = iguana_memalloc(mem,msg->pk_scriptlen,1); len += iguana_rwmem(rwflag,&serialized[len],msg->pk_scriptlen,msg->pk_script); @@ -660,9 +662,9 @@ int32_t iguana_rwtx(struct supernet_info *myinfo,uint8_t zcash,int32_t rwflag,st msg->vouts = iguana_memalloc(mem,msg->tx_out * sizeof(*msg->vouts),1); for (i=0; itx_out; i++) { - if ( (n= iguana_rwvout(rwflag,mem,&serialized[len],&msg->vouts[i])) >= 0 ) + if ( (n= iguana_rwvout(rwflag,mem,&serialized[len],&msg->vouts[i])) > 0 ) len += n; - if ( n < 0 || len > maxsize ) + if ( n <= 0 || len > maxsize ) { printf("invalid tx_out.%d len.%d vs maxsize.%d\n",msg->tx_out,len,maxsize); return(-1); diff --git a/iguana/iguana_tx.c b/iguana/iguana_tx.c index c0de5e366..d71912f68 100755 --- a/iguana/iguana_tx.c +++ b/iguana/iguana_tx.c @@ -101,7 +101,7 @@ int32_t iguana_voutscript(struct iguana_info *coin,struct iguana_bundle *bp,uint { iguana_voutsfname(coin,bp->ramchain.from_ro,fname,u->fileid); if ( (scriptlen= iguana_scriptdata(coin,scriptspace,coin->voutptrs[u->fileid],fname,u->scriptpos,u->scriptlen)) != u->scriptlen ) - printf("%d bytes from fileid.%d[%d] %s for type.%d\n",u->scriptlen,u->fileid,u->scriptpos,fname,u->type); + printf("scriptlen.%d != %d bytes from fileid.%d[%d] %s for type.%d\n",scriptlen,u->scriptlen,u->fileid,u->scriptpos,fname,u->type); } else {