From 5402941691dff1c9a18b353c997a834e5ce5946f Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 4 Feb 2013 10:22:10 +1100 Subject: [PATCH] Use heap ram for coinbase in gen_stratum_work, zeroing it before use. --- cgminer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cgminer.c b/cgminer.c index 32fd47a9..71b663b2 100644 --- a/cgminer.c +++ b/cgminer.c @@ -5102,7 +5102,7 @@ static void gen_stratum_work(struct pool *pool, struct work *work) len = cb1_len + n1_len + pool->n2size + cb2_len; alloc_len = len; align_len(&alloc_len); - coinbase = alloca(alloc_len); + coinbase = calloc(alloc_len, 1); hex2bin(coinbase, pool->swork.coinbase1, cb1_len); hex2bin(coinbase + cb1_len, pool->nonce1, n1_len); hex2bin(coinbase + cb1_len + n1_len, work->nonce2, pool->n2size); @@ -5110,6 +5110,7 @@ static void gen_stratum_work(struct pool *pool, struct work *work) /* Generate merkle root */ gen_hash(coinbase, merkle_root, len); + free(coinbase); memcpy(merkle_sha, merkle_root, 32); for (i = 0; i < pool->swork.merkles; i++) { unsigned char merkle_bin[32];