Fixed Windows build errors (strndup not portable)

Fixes #223