bugfix: unitialized buffer off-by-one error in hostname generation

The DNS cache used uninitialized memory, which could lead to
invalid hostname generation.
Thanks to Jarrod Sayers for alerting us and provinding analysis and
patch recommendations.