apps/rehash.c:193: error: BUFFER_OVERRUN_L3
  Offset added: [1, 4096] Size: [1, 4096] by call to `add_entry`.
Showing all 14 steps of the trace


apps/rehash.c:160:1: Array declaration
158.    * This can be -1 if bad filename, or an error count.
159.    */
160. > static int handle_symlink(const char *filename, const char *fullpath)
161.   {
162.       unsigned int hash = 0;

apps/rehash.c:193:12: Call
191.       linktarget[n] = 0;
192.   
193.       return add_entry(type, hash, linktarget, NULL, 0, id);
                  ^
194.   }
195.   

apps/rehash.c:92:1: Parameter `filename->strlen`
  90.    * Process an entry; return number of errors.
  91.    */
  92. > static int add_entry(enum Type type, unsigned int hash, const char *filename,
  93.                         const unsigned char *digest, int need_symlink,
  94.                         unsigned short old_id)

apps/rehash.c:138:24: Call
  136.           *ep = nilhentry;
  137.           ep->old_id = ~0;
  138.           ep->filename = OPENSSL_strdup(filename);
                                ^
  139.           if (bp->last_entry)
  140.               bp->last_entry->next = ep;

crypto/o_str.c:28:1: <Offset trace>
26.   }
27.   
28. > char *CRYPTO_strdup(const char *str, const char* file, int line)
29.   {
30.       char *ret;

crypto/o_str.c:28:1: Parameter `str->strlen`
    26.   }
    27.   
    28. > char *CRYPTO_strdup(const char *str, const char* file, int line)
    29.   {
    30.       char *ret;

crypto/o_str.c:35:5: Assignment
    33.       if (str == NULL)
    34.           return NULL;
    35.       size = strlen(str) + 1;
              ^
    36.       ret = CRYPTO_malloc(size, file, line);
    37.       if (ret != NULL)

crypto/o_str.c:28:1: <Length trace>
26.   }
27.   
28. > char *CRYPTO_strdup(const char *str, const char* file, int line)
29.   {
30.       char *ret;

crypto/o_str.c:28:1: Parameter `str->strlen`
    26.   }
    27.   
    28. > char *CRYPTO_strdup(const char *str, const char* file, int line)
    29.   {
    30.       char *ret;

crypto/o_str.c:35:5: Assignment
    33.       if (str == NULL)
    34.           return NULL;
    35.       size = strlen(str) + 1;
              ^
    36.       ret = CRYPTO_malloc(size, file, line);
    37.       if (ret != NULL)

crypto/o_str.c:36:11: Call
    34.           return NULL;
    35.       size = strlen(str) + 1;
    36.       ret = CRYPTO_malloc(size, file, line);
                    ^
    37.       if (ret != NULL)
    38.           memcpy(ret, str, size);

crypto/mem.c:165:9: Assignment
      163.   
      164.       if (num <= 0)
      165.           return NULL;
                     ^
      166.   
      167.       FAILTEST();

crypto/o_str.c:36:5: Assignment
    34.           return NULL;
    35.       size = strlen(str) + 1;
    36.       ret = CRYPTO_malloc(size, file, line);
              ^
    37.       if (ret != NULL)
    38.           memcpy(ret, str, size);

crypto/o_str.c:38:9: Array access: Offset added: [1, 4096] Size: [1, 4096] by call to `add_entry` 
    36.       ret = CRYPTO_malloc(size, file, line);
    37.       if (ret != NULL)
    38.           memcpy(ret, str, size);
                  ^
    39.       return ret;
    40.   }

char *CRYPTO_strdup(const char *str, const char* file, int line)
{
    char *ret;
    size_t size;
    if (str == NULL)
        return NULL;
    size = strlen(str) + 1;
    ret = CRYPTO_malloc(size, file, line);
    if (ret != NULL)
        memcpy(ret, str, size);
    return ret;
}
["static int handle_symlink(const char *filename, const char *fullpath)\n{\n    unsigned int hash = 0;\n    int i, type, id;\n    unsigned char ch;\n    char linktarget[PATH_MAX], *endptr;\n    ossl_ssize_t n;\n    for (i = 0; i < 8; i++) {\n        ch = filename[i];\n        if (!isxdigit(ch))\n            return -1;\n        hash <<= 4;\n        hash += OPENSSL_hexchar2int(ch);\n    }\n    if (filename[i++] != '.')\n        return -1;\n    for (type = OSSL_NELEM(suffixes) - 1; type > 0; type--) {\n        const char *suffix = suffixes[type];\n        if (strncasecmp(suffix, &filename[i], strlen(suffix)) == 0)\n            break;\n    }\n    i += strlen(suffixes[type]);\n    id = strtoul(&filename[i], &endptr, 10);\n    if (*endptr != '\\0')\n        return -1;\n    n = readlink(fullpath, linktarget, sizeof(linktarget));\n    if (n < 0 || n >= (int)sizeof(linktarget))\n        return -1;\n    linktarget[n] = 0;\n    return add_entry(type, hash, linktarget, NULL, 0, id);\n}", 'static int add_entry(enum Type type, unsigned int hash, const char *filename,\n                      const unsigned char *digest, int need_symlink,\n                      unsigned short old_id)\n{\n    static BUCKET nilbucket;\n    static HENTRY nilhentry;\n    BUCKET *bp;\n    HENTRY *ep, *found = NULL;\n    unsigned int ndx = (type + hash) % OSSL_NELEM(hash_table);\n    for (bp = hash_table[ndx]; bp; bp = bp->next)\n        if (bp->type == type && bp->hash == hash)\n            break;\n    if (bp == NULL) {\n        bp = app_malloc(sizeof(*bp), "hash bucket");\n        *bp = nilbucket;\n        bp->next = hash_table[ndx];\n        bp->type = type;\n        bp->hash = hash;\n        hash_table[ndx] = bp;\n    }\n    for (ep = bp->first_entry; ep; ep = ep->next) {\n        if (digest && memcmp(digest, ep->digest, evpmdsize) == 0) {\n            BIO_printf(bio_err,\n                       "%s: skipping duplicate %s in %s\\n", opt_getprog(),\n                       type == TYPE_CERT ? "certificate" : "CRL", filename);\n            return 1;\n        }\n        if (strcmp(filename, ep->filename) == 0) {\n            found = ep;\n            if (digest == NULL)\n                break;\n        }\n    }\n    ep = found;\n    if (ep == NULL) {\n        if (bp->num_needed >= MAX_COLLISIONS) {\n            BIO_printf(bio_err,\n                       "%s: hash table overflow for %s\\n",\n                       opt_getprog(), filename);\n            return 1;\n        }\n        ep = app_malloc(sizeof(*ep), "collision bucket");\n        *ep = nilhentry;\n        ep->old_id = ~0;\n        ep->filename = OPENSSL_strdup(filename);\n        if (bp->last_entry)\n            bp->last_entry->next = ep;\n        if (bp->first_entry == NULL)\n            bp->first_entry = ep;\n        bp->last_entry = ep;\n    }\n    if (old_id < ep->old_id)\n        ep->old_id = old_id;\n    if (need_symlink && !ep->need_symlink) {\n        ep->need_symlink = 1;\n        bp->num_needed++;\n        memcpy(ep->digest, digest, evpmdsize);\n    }\n    return 0;\n}', 'char *CRYPTO_strdup(const char *str, const char* file, int line)\n{\n    char *ret;\n    size_t size;\n    if (str == NULL)\n        return NULL;\n    size = strlen(str) + 1;\n    ret = CRYPTO_malloc(size, file, line);\n    if (ret != NULL)\n        memcpy(ret, str, size);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num <= 0)\n        return NULL;\n    FAILTEST();\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    osslargused(file); osslargused(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}']