Commit 71bbd583e05c38d69bcb9afb05caa980f02d8a83

Luke Dashjr 2012-08-10T22:19:17

Bugfix: bitforce: Allocate enough space for FTDI description pointers Alloca that needs the dthe size in bytes rather than elements.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/driver-bitforce.c b/driver-bitforce.c
index ca6b8b0..8fb86aa 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -175,7 +175,7 @@ static int bitforce_autodetect_ftdi(void)
 	applog(LOG_DEBUG, "FTDI reports %u devices", (unsigned)numDevs);
 
 	buf = alloca(65 * numDevs);
-	bufptrs = alloca(numDevs + 1);
+	bufptrs = alloca(sizeof(*bufptrs) * (numDevs + 1));
 
 	for (i = 0; i < numDevs; ++i)
 		bufptrs[i] = &buf[i * 65];