fixup for bug-20755. Replaces strndup with malloc and memcpy for Solaris.