It would not be efficient to guarantee thread safety at this level. Thread safety would be guaranteed by the caller either by simply knowing that the message in buf is safe during this operation, or by providing the locking necessary at the message level to ensure it.
If you mean that this function could not be called in parallel then the modification I would make would simply be to have the caller pass in the buffer tmpBuf that is to be filled.
An even smarter implementation would be to write the checksum directly to the end of buf without using sprintf - something like [dusts off C syntax]