Correct header creation. Ensure the new string contains enough NUL bytes.