Make sure the local static buffer is large enough, and simplify the sprintf for merging the fields all into one. This fixes compiler warnings from buf possibly being overflowed.