Pass the length along when outputting from printf

If there's no length, the result is treated as a null-terminated string
which means that null characters incorrectly stop the output.

The changes to the two existing test outputs are the addition of the null characters and the rest of the string as well as an ending new line (I don't have a text editor that can handle null characters properly on save, so piped and then used sed for the expectf. As whitespace in tests is now trimmed, the change has no effect)