Limit copy range

This commit is contained in:
jl777
2019-04-02 01:29:54 -11:00
parent d93b34b04a
commit 0d94b7d7b8

View File

@@ -1203,7 +1203,7 @@ UniValue prices(const UniValue& params, bool fHelp)
throw JSONRPCError(RPC_INVALID_PARAMETER, "illegal numpricefeeds");
prices = (uint32_t *)calloc(sizeof(*prices),width*numpricefeeds);
correlated = (int64_t *)calloc(sizeof(*correlated),width);
for (ht=nextheight-1,i=0; i<width&&ht>2*daywindow+2; i++,ht--)
for (ht=nextheight-1,i=0; i<numpricefeeds&&ht>2*daywindow+2; i++,ht--)
{
if ( ht < 0 || ht > chainActive.Height() )
throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range");