apps/rehash.c:204: error: BUFFER_OVERRUN_L3
  Offset: [0, 4095] Size: [1, 4096] by call to `add_entry`.
Showing all 12 steps of the trace


apps/rehash.c:171:1: Array declaration
169.    * This can be -1 if bad filename, or an error count.
170.    */
171. > static int handle_symlink(const char *filename, const char *fullpath)
172.   {
173.       unsigned int hash = 0;

apps/rehash.c:204:12: Call
202.       linktarget[n] = 0;
203.   
204.       return add_entry(type, hash, linktarget, NULL, 0, id);
                  ^
205.   }
206.   

apps/rehash.c:103:1: Parameter `filename->strlen`
  101.    * Process an entry; return number of errors.
  102.    */
  103. > static int add_entry(enum Type type, unsigned int hash, const char *filename,
  104.                         const unsigned char *digest, int need_symlink,
  105.                         unsigned short old_id)

apps/rehash.c:149:24: Call
  147.           *ep = nilhentry;
  148.           ep->old_id = ~0;
  149.           ep->filename = OPENSSL_strdup(filename);
                                ^
  150.           if (bp->last_entry)
  151.               bp->last_entry->next = ep;

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

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

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

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

crypto/o_str.c:33:11: Call
    31.       if (str == NULL)
    32.           return NULL;
    33.       ret = CRYPTO_malloc(strlen(str) + 1, file, line);
                    ^
    34.       if (ret != NULL)
    35.           strcpy(ret, str);

crypto/mem.c:178:9: Assignment
      176.   
      177.       if (num == 0)
      178.           return NULL;
                     ^
      179.   
      180.       FAILTEST();

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

crypto/o_str.c:35:9: Array access: Offset: [0, 4095] Size: [1, 4096] by call to `add_entry` 
    33.       ret = CRYPTO_malloc(strlen(str) + 1, file, line);
    34.       if (ret != NULL)
    35.           strcpy(ret, str);
                  ^
    36.       return ret;
    37.   }

char *CRYPTO_strdup(const char *str, const char* file, int line)
{
    char *ret;
    if (str == NULL)
        return NULL;
    ret = CRYPTO_malloc(strlen(str) + 1, file, line);
    if (ret != NULL)
        strcpy(ret, str);
    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    if (str == NULL)\n        return NULL;\n    ret = CRYPTO_malloc(strlen(str) + 1, file, line);\n    if (ret != NULL)\n        strcpy(ret, str);\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    (void)(file); (void)(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}']