fix buffer overflow
Merge pull request #5523 from chinhodado/patch-1

fix buffer overflow