Fix a heap buffer overflow.