Kamil Kukura <kamk(at)volny(dot)cz> writes:
> Is there something I'm missing when data are passed from function to
> function?
I get the impression your function is expecting the contents of a text
datum to be null-terminated. It's not.
regards, tom lane