buffer was one line too short and while that "works" on many systems (linux
intel, OSX PPC) it is luck due to malloc() implementations and memory layout.
Until someone who understands the program has some time the workaround is to
allocate a larger intermediate buffer.