Commit 9bcd5ca82362363c3930c5e51572e7b9b4d91181

Con Kolivas 2013-12-02T17:20:02

Having changed C_MAX means we don't calloc enough for usb stats, off by one.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/usbutils.c b/usbutils.c
index 4195855..6f20840 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2206,7 +2206,7 @@ static void newstats(struct cgpu_info *cgpu)
 
 	usb_stats[next_stat].name = cgpu->drv->name;
 	usb_stats[next_stat].device_id = -1;
-	usb_stats[next_stat].details = calloc(1, sizeof(struct cg_usb_stats_details) * C_MAX * 2);
+	usb_stats[next_stat].details = calloc(2, sizeof(struct cg_usb_stats_details) * (C_MAX + 1));
 	if (unlikely(!usb_stats[next_stat].details))
 		quit(1, "USB failed to calloc details for %d", next_stat+1);