Commit b68124b0f9b03543d61fdc493814cac34e8b92b5

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 544b855..9aedc42 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2172,7 +2172,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);