Commit 2bdcc9d174d8b81406ff1e9772460b0f0c230f7d

Con Kolivas 2014-03-28T08:33:46

Fix off by one malloc size error

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/cgminer.c b/cgminer.c
index 3d19c14..786ad5b 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2163,7 +2163,7 @@ static void gbt_merkle_bins(struct pool *pool, json_t *transaction_arr)
 			len += strlen(txn);
 		}
 
-		pool->txn_data = malloc(len);
+		pool->txn_data = malloc(len + 1);
 		if (unlikely(!pool->txn_data))
 			quit(1, "Failed to calloc txn_data in gbt_merkle_bins");
 		pool->txn_data[len] = '\0';