crypto/err/err.c:289: error: BUFFER_OVERRUN_L3
  Offset: [16, +oo] Size: [1, +oo] by call to `lh_ERR_STRING_DATA_insert`.
Showing all 17 steps of the trace


crypto/err/err.c:283:26: Call
281.       CRYPTO_THREAD_write_lock(err_string_lock);
282.       if (int_error_hash == NULL)
283.           int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,
                                ^
284.                                                   err_string_data_cmp);
285.       if (int_error_hash != NULL) {

include/openssl/err.h:203:1: Call
  201.   } ERR_STRING_DATA;
  202.   
  203. > DEFINE_LHASH_OF(ERR_STRING_DATA);
  204.   
  205.   void ERR_put_error(int lib, int func, int reason, const char *file, int line);

crypto/lhash/lhash.c:38:5: Assignment
    36.       ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);
    37.       ret->num_nodes = MIN_NODES / 2;
    38.       ret->num_alloc_nodes = MIN_NODES;
              ^
    39.       ret->pmax = MIN_NODES / 2;
    40.       ret->up_load = UP_LOAD;

crypto/err/err.c:289:19: Call
287.               if (lib)
288.                   str->error |= ERR_PACK(lib, 0, 0);
289.               (void)lh_ERR_STRING_DATA_insert(int_error_hash, str);
                         ^
290.           }
291.       }

include/openssl/err.h:203:1: Parameter `lh->num_alloc_nodes`
  201.   } ERR_STRING_DATA;
  202.   
  203. > DEFINE_LHASH_OF(ERR_STRING_DATA);
  204.   
  205.   void ERR_put_error(int lib, int func, int reason, const char *file, int line);

include/openssl/err.h:203:1: Call
  201.   } ERR_STRING_DATA;
  202.   
  203. > DEFINE_LHASH_OF(ERR_STRING_DATA);
  204.   
  205.   void ERR_put_error(int lib, int func, int reason, const char *file, int line);

crypto/lhash/lhash.c:70:1: Parameter `lh->num_alloc_nodes`
    68.   }
    69.   
    70. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)
    71.   {
    72.       unsigned long hash;

crypto/lhash/lhash.c:77:77: Call
    75.   
    76.       lh->error = 0;
    77.       if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
                                                                                      ^
    78.           return NULL;        /* 'lh->error++' already done in 'expand' */
    79.   

crypto/lhash/lhash.c:187:1: <Offset trace>
185.   }
186.   
187. > static int expand(OPENSSL_LHASH *lh)
188.   {
189.       OPENSSL_LH_NODE **n, **n1, **n2, *np;

crypto/lhash/lhash.c:187:1: Parameter `lh->num_alloc_nodes`
      185.   }
      186.   
      187. > static int expand(OPENSSL_LHASH *lh)
      188.   {
      189.       OPENSSL_LH_NODE **n, **n1, **n2, *np;

crypto/lhash/lhash.c:213:9: Assignment
      211.   
      212.       if ((lh->p) >= lh->pmax) {
      213.           j = (int)lh->num_alloc_nodes * 2;
                     ^
      214.           n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
      215.           if (n == NULL) {

crypto/lhash/lhash.c:187:1: <Length trace>
185.   }
186.   
187. > static int expand(OPENSSL_LHASH *lh)
188.   {
189.       OPENSSL_LH_NODE **n, **n1, **n2, *np;

crypto/lhash/lhash.c:187:1: Parameter `*lh->b`
      185.   }
      186.   
      187. > static int expand(OPENSSL_LHASH *lh)
      188.   {
      189.       OPENSSL_LH_NODE **n, **n1, **n2, *np;

crypto/lhash/lhash.c:214:13: Call
      212.       if ((lh->p) >= lh->pmax) {
      213.           j = (int)lh->num_alloc_nodes * 2;
      214.           n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
                         ^
      215.           if (n == NULL) {
      216.               /* fputs("realloc error in lhash",stderr); */

crypto/mem.c:117:9: Assignment
        115.       if (num == 0) {
        116.           CRYPTO_free(str, file, line);
        117.           return NULL;
                       ^
        118.       }
        119.   

crypto/lhash/lhash.c:214:9: Assignment
      212.       if ((lh->p) >= lh->pmax) {
      213.           j = (int)lh->num_alloc_nodes * 2;
      214.           n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
                     ^
      215.           if (n == NULL) {
      216.               /* fputs("realloc error in lhash",stderr); */

crypto/lhash/lhash.c:222:13: Array access: Offset: [16, +oo] Size: [1, +oo] by call to `lh_ERR_STRING_DATA_insert` 
      220.           }
      221.           for (i = (int)lh->num_alloc_nodes; i < j; i++) /* 26/02/92 eay */
      222.               n[i] = NULL;        /* 02/03/92 eay */
                         ^
      223.           lh->pmax = lh->num_alloc_nodes;
      224.           lh->num_alloc_nodes = j;

static int expand(OPENSSL_LHASH *lh)
{
    OPENSSL_LH_NODE **n, **n1, **n2, *np;
    unsigned int p, i, j;
    unsigned long hash, nni;
    lh->num_nodes++;
    lh->num_expands++;
    p = (int)lh->p++;
    n1 = &(lh->b[p]);
    n2 = &(lh->b[p + (int)lh->pmax]);
    *n2 = NULL;
    nni = lh->num_alloc_nodes;
    for (np = *n1; np != NULL;) {
        hash = np->hash;
        if ((hash % nni) != p) {
            *n1 = (*n1)->next;
            np->next = *n2;
            *n2 = np;
        } else
            n1 = &((*n1)->next);
        np = *n1;
    }
    if ((lh->p) >= lh->pmax) {
        j = (int)lh->num_alloc_nodes * 2;
        n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
        if (n == NULL) {
            lh->error++;
            lh->p = 0;
            return 0;
        }
        for (i = (int)lh->num_alloc_nodes; i < j; i++)
            n[i] = NULL;
        lh->pmax = lh->num_alloc_nodes;
        lh->num_alloc_nodes = j;
        lh->num_expand_reallocs++;
        lh->p = 0;
        lh->b = n;
    }
    return 1;
}
['static void err_load_strings(int lib, ERR_STRING_DATA *str)\n{\n    CRYPTO_THREAD_write_lock(err_string_lock);\n    if (int_error_hash == NULL)\n        int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,\n                                                err_string_data_cmp);\n    if (int_error_hash != NULL) {\n        for (; str->error; str++) {\n            if (lib)\n                str->error |= ERR_PACK(lib, 0, 0);\n            (void)lh_ERR_STRING_DATA_insert(int_error_hash, str);\n        }\n    }\n    CRYPTO_THREAD_unlock(err_string_lock);\n}', 'DEFINE_LHASH_OF(ERR_STRING_DATA)', 'OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c)\n{\n    OPENSSL_LHASH *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)\n        goto err0;\n    if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)\n        goto err1;\n    ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c);\n    ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);\n    ret->num_nodes = MIN_NODES / 2;\n    ret->num_alloc_nodes = MIN_NODES;\n    ret->pmax = MIN_NODES / 2;\n    ret->up_load = UP_LOAD;\n    ret->down_load = DOWN_LOAD;\n    return (ret);\n err1:\n    OPENSSL_free(ret);\n err0:\n    return (NULL);\n}', 'void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)\n{\n    unsigned long hash;\n    OPENSSL_LH_NODE *nn, **rn;\n    void *ret;\n    lh->error = 0;\n    if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))\n        return NULL;\n    rn = getrn(lh, data, &hash);\n    if (*rn == NULL) {\n        if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {\n            lh->error++;\n            return (NULL);\n        }\n        nn->data = data;\n        nn->next = NULL;\n        nn->hash = hash;\n        *rn = nn;\n        ret = NULL;\n        lh->num_insert++;\n        lh->num_items++;\n    } else {\n        ret = (*rn)->data;\n        (*rn)->data = data;\n        lh->num_replace++;\n    }\n    return (ret);\n}', 'static int expand(OPENSSL_LHASH *lh)\n{\n    OPENSSL_LH_NODE **n, **n1, **n2, *np;\n    unsigned int p, i, j;\n    unsigned long hash, nni;\n    lh->num_nodes++;\n    lh->num_expands++;\n    p = (int)lh->p++;\n    n1 = &(lh->b[p]);\n    n2 = &(lh->b[p + (int)lh->pmax]);\n    *n2 = NULL;\n    nni = lh->num_alloc_nodes;\n    for (np = *n1; np != NULL;) {\n        hash = np->hash;\n        if ((hash % nni) != p) {\n            *n1 = (*n1)->next;\n            np->next = *n2;\n            *n2 = np;\n        } else\n            n1 = &((*n1)->next);\n        np = *n1;\n    }\n    if ((lh->p) >= lh->pmax) {\n        j = (int)lh->num_alloc_nodes * 2;\n        n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));\n        if (n == NULL) {\n            lh->error++;\n            lh->p = 0;\n            return 0;\n        }\n        for (i = (int)lh->num_alloc_nodes; i < j; i++)\n            n[i] = NULL;\n        lh->pmax = lh->num_alloc_nodes;\n        lh->num_alloc_nodes = j;\n        lh->num_expand_reallocs++;\n        lh->p = 0;\n        lh->b = n;\n    }\n    return 1;\n}', 'void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)\n{\n    if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)\n        return realloc_impl(str, num, file, line);\n    if (str == NULL)\n        return CRYPTO_malloc(num, file, line);\n    if (num == 0) {\n        CRYPTO_free(str, file, line);\n        return NULL;\n    }\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        void *ret;\n        CRYPTO_mem_debug_realloc(str, NULL, num, 0, file, line);\n        ret = realloc(str, num);\n        CRYPTO_mem_debug_realloc(str, ret, num, 1, file, line);\n        return ret;\n    }\n#else\n    osslargused(file); osslargused(line);\n#endif\n    return realloc(str, num);\n}']