Properly terminate the result string for intermediate results, to
allow the final strcpy() to start at the intended place.

Reported and tested by:	pgj
Pointy hat to:	kib
MFC after:	3 days