Fix potential buffer overrun
Merge pull request #395 from Dmitry-Me/fixBufferOverrun

Fix potential buffer overrun