using strndup in stead of strdup fixes this acording to the attached git-diff.
so it remains to make sure strndup is portable I guess.

/Stefan

On Sat, Sep 10, 2011 at 3:33 AM, David Hansen <david.hansen@gmx.net> wrote:
Hello,

the attached code produces

$ ./a.out
foo,bar
bar

while I would expect

$ ./a.out
foo
bar

Similar behavior can be produced with `substring', but `substring/copy'
will work as expected.  So I suspect this is some issue with strings
sharing memory and a missing '0' when scm_to_latin1_string calls
scm_strdup.

David