Fix massive buffer overflow. How did that ever work?