cmd/cgo: fix C.CString for strings containing null terminators under gccgo
cmd/cgo: fix C.CString for strings containing null terminators under gccgo

Previously we used strndup(3) to implement C.CString for gccgo. This
is wrong because strndup assumes the string to be null terminated,
and stops at the first null terminator. Instead, use malloc
and memmove to create a copy of the string, as we do in the
gc implementation.

LGTM=iant
R=iant
CC=golang-codereviews
https://codereview.appspot.com/96790047

Committer: Ian Lance Taylor <87e9c6d529889242b7e184afb632328636553ab4@golang.org>

tv42/old-go,tv42/old-go,tv42/old-go,tv42/old-go,pombredanne/go-deleteme,pombredanne/go-deleteme,pombredanne/go-deleteme,pombredanne/go-deleteme,pombredanne/go-deleteme,pombredanne/go-deleteme,pombredanne/go-deleteme,tv42/old-go,tv42/old-go,tv42/old-go