Bloody off-by-1 error for a malloc, leading to ever-so-slight memory corruption....