crypto/x509/x509_vpm.c:100: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64.
Showing all 3 steps of the trace


crypto/x509/x509_vpm.c:86:1: <LHS trace>
84.   }
85.   
86. > static int int_x509_param_set_hosts(X509_VERIFY_PARAM *vpm, int mode,
87.                                       const char *name, size_t namelen)
88.   {

crypto/x509/x509_vpm.c:86:1: Parameter `namelen`
84.   }
85.   
86. > static int int_x509_param_set_hosts(X509_VERIFY_PARAM *vpm, int mode,
87.                                       const char *name, size_t namelen)
88.   {

crypto/x509/x509_vpm.c:100:9: Binary operation: ([0, +oo] - 1):unsigned64
98.           return 0;
99.       if (name && name[namelen - 1] == '\0')
100.           --namelen;
               ^
101.   
102.       if (mode == SET_HOST) {

static int int_x509_param_set_hosts(X509_VERIFY_PARAM *vpm, int mode,
                                    const char *name, size_t namelen)
{
    char *copy;
    if (namelen == 0)
        namelen = name ? strlen(name) : 0;
    else if (name && memchr(name, '\0', namelen > 1 ? namelen - 1 : namelen))
        return 0;
    if (name && name[namelen - 1] == '\0')
        --namelen;
    if (mode == SET_HOST) {
        sk_OPENSSL_STRING_pop_free(vpm->hosts, str_free);
        vpm->hosts = NULL;
    }
    if (name == NULL || namelen == 0)
        return 1;
    copy = BUF_strndup(name, namelen);
    if (copy == NULL)
        return 0;
    if (vpm->hosts == NULL &&
        (vpm->hosts = sk_OPENSSL_STRING_new_null()) == NULL) {
        OPENSSL_free(copy);
        return 0;
    }
    if (!sk_OPENSSL_STRING_push(vpm->hosts, copy)) {
        OPENSSL_free(copy);
        if (sk_OPENSSL_STRING_num(vpm->hosts) == 0) {
            sk_OPENSSL_STRING_free(vpm->hosts);
            vpm->hosts = NULL;
        }
        return 0;
    }
    return 1;
}
["static int int_x509_param_set_hosts(X509_VERIFY_PARAM *vpm, int mode,\n                                    const char *name, size_t namelen)\n{\n    char *copy;\n    if (namelen == 0)\n        namelen = name ? strlen(name) : 0;\n    else if (name && memchr(name, '\\0', namelen > 1 ? namelen - 1 : namelen))\n        return 0;\n    if (name && name[namelen - 1] == '\\0')\n        --namelen;\n    if (mode == SET_HOST) {\n        sk_OPENSSL_STRING_pop_free(vpm->hosts, str_free);\n        vpm->hosts = NULL;\n    }\n    if (name == NULL || namelen == 0)\n        return 1;\n    copy = BUF_strndup(name, namelen);\n    if (copy == NULL)\n        return 0;\n    if (vpm->hosts == NULL &&\n        (vpm->hosts = sk_OPENSSL_STRING_new_null()) == NULL) {\n        OPENSSL_free(copy);\n        return 0;\n    }\n    if (!sk_OPENSSL_STRING_push(vpm->hosts, copy)) {\n        OPENSSL_free(copy);\n        if (sk_OPENSSL_STRING_num(vpm->hosts) == 0) {\n            sk_OPENSSL_STRING_free(vpm->hosts);\n            vpm->hosts = NULL;\n        }\n        return 0;\n    }\n    return 1;\n}"]