Fix buffer overflow

We should consider about string terminate '\0'.