Is sprintf(buffer, “%s […]”, buffer, […]) safe?
From the glibc sprintf() documentation: The behavior of this function is undefined if copying takes place between objects that overlap—for example, if s is also given as an argument to be printed under control of the ‘%s’ conversion. It may be safe in a particular implementation; but you could not count on it being portable. … Read more