Fix a possible buffer overflow