From baee6ac66ca405240f299f501c3b186c3bae2137 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 8 Mar 2016 00:45:46 -0300 Subject: [PATCH] test --- iguana/iguana_scripts.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/iguana_scripts.c b/iguana/iguana_scripts.c index 0bd8d9e57..698c34811 100755 --- a/iguana/iguana_scripts.c +++ b/iguana/iguana_scripts.c @@ -710,7 +710,7 @@ int32_t bitcoin_scriptget(struct iguana_info *coin,int32_t *hashtypep,int32_t *s return(vp->spendlen); } j = 0; - while ( ((plen= scriptsig[n]) == 33 || plen == 65 ) && j < 16 ) + while ( ((plen= scriptsig[n]) == 33 || plen == 65) && j < 16 && plen+n <= len ) { memcpy(vp->signers[j].pubkey,&scriptsig[n+1],plen); calc_rmd160_sha256(vp->signers[j].rmd160,vp->signers[j].pubkey,plen); @@ -721,13 +721,13 @@ int32_t bitcoin_scriptget(struct iguana_info *coin,int32_t *hashtypep,int32_t *s j++; } vp->numpubkeys = j; - if ( n < len && (scriptsig[n] == 0x4c || scriptsig[n] == 0x4d) ) + if ( n+2 < len && (scriptsig[n] == 0x4c || scriptsig[n] == 0x4d) ) { if ( scriptsig[n] == 0x4c ) vp->p2shlen = scriptsig[n+1], n += 2; else vp->p2shlen = ((uint32_t)scriptsig[n+1] + ((uint32_t)scriptsig[n+2] << 8)), n += 3; printf("p2sh opcode.%02x %02x %02x scriptlen.%d\n",scriptsig[n],scriptsig[n+1],scriptsig[n+2],vp->p2shlen); - if ( vp->p2shlen < IGUANA_MAXSCRIPTSIZE ) + if ( vp->p2shlen < IGUANA_MAXSCRIPTSIZE && n+vp->p2shlen <= len ) { memcpy(vp->p2shscript,&scriptsig[n],vp->p2shlen); n += vp->p2shlen;