From fa3a25f8762169c5f0d586ee597d3918b0cf4b94 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 10 Aug 2012 22:19:17 +0000 Subject: [PATCH] Bugfix: bitforce: Allocate enough space for FTDI description pointers Con's uglify of the FTDI autodetect replaced a standard C99 array with non-standard alloca that needs the developer to specify the size in bytes rather than elements, but he didn't account for pointer size at all --- driver-bitforce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver-bitforce.c b/driver-bitforce.c index bacac16c..980c4bf4 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];