Those functions modify a global char array (a string).
Let's pass a buffer to those functions, so that it's
thread safe. The caller has been modified, with hopefully
a buffer big enough (still bigger than what was there before,
so should not break more than it did).