binarybuffer: use strndup to allocate string