TRQ-1900. Change a sprintf to a snprintf. Also remove the random adding of space for another char at the end of a buffer.