Fix potential output buffer overflow in encoder.
Merge pull request #13 from szabadka/master

Fix potential output buffer overflow in encoder.