Fix buffer overflow

We should consider about string terminate '\0'.
Merge pull request #3 from kou/fix-buffer-overflow

Fix buffer overflow