Fix buffer overflow in parser