Fix potential buffer overflow
Fix potential buffer overflow

Under certain circumstances, it would be possible for a too-large number sent
cause a buffer overflow by passing a too-large endpos.

flaviut/nre