Move default return to clarify function always returns.
(Fixes false positives with Coverity and Clang static checkers.)
Make sure to leave room to null-terminate tmp strings.

Error found via Coverity Scan.