From 69ed6efcb215c1e6656da0a201142ab418674934 Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Thu, 9 Jul 2015 16:12:38 -0400 Subject: [PATCH] Allocate memory for block buffer. --- integration/index.js | 2 +- src/bitcoindjs.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/index.js b/integration/index.js index 2eb4160b..04849e6c 100644 --- a/integration/index.js +++ b/integration/index.js @@ -51,7 +51,7 @@ describe('Basic Functionality', function() { var block = bitcore.Block.fromString(data); it('block ' + block.hash, function(done) { bitcoind.getBlock(block.hash, function(err, response) { - assert(response === data, 'incorrect block data for ' + block.hash); + assert(response.toString('hex') === data, 'incorrect block data for ' + block.hash); done(); }); }); diff --git a/src/bitcoindjs.cc b/src/bitcoindjs.cc index 8b11078d..0c0c6bc5 100644 --- a/src/bitcoindjs.cc +++ b/src/bitcoindjs.cc @@ -869,7 +869,7 @@ async_get_block(uv_work_t *req) { fread(&size, sizeof(uint32_t), 1, blockFile); // Read block - char buffer[size]; + char* buffer = (char *)malloc(sizeof(char) * size); fread((void *)buffer, sizeof(char), size, blockFile); fclose(blockFile);