static int int_x509_param_set1(char **pdest, size_t *pdestlen,
                               const char *src, size_t srclen)
{
    void *tmp;
    if (src) {
        if (srclen == 0) {
            tmp = OPENSSL_strdup(src);
            srclen = strlen(src);
        } else
            tmp = OPENSSL_memdup(src, srclen);
        if (!tmp)
            return 0;
    } else {
        tmp = NULL;
        srclen = 0;
    }
    OPENSSL_free(*pdest);
    *pdest = tmp;
    if (pdestlen)
        *pdestlen = srclen;
    return 1;
}