trq-2085 Fixed an overrun on a calloc'd buffer and improved efficiency of sprintf loop.