apps/rehash.c:231: 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:200:1: Array declaration
198.    * This can be -1 if bad filename, or an error count.
199.    */
200. > static int handle_symlink(const char *filename, const char *fullpath)
201.   {
202.       unsigned int hash = 0;

apps/rehash.c:231:12: Call
229.       linktarget[n] = 0;
230.   
231.       return add_entry(type, hash, linktarget, NULL, 0, id);
                  ^
232.   }
233.   

apps/rehash.c:132:1: Parameter `filename->strlen`
  130.    * Process an entry; return number of errors.
  131.    */
  132. > static int add_entry(enum Type type, unsigned int hash, const char *filename,
  133.                         const unsigned char *digest, int need_symlink,
  134.                         unsigned short old_id)

apps/rehash.c:178:24: Call
  176.           *ep = nilhentry;
  177.           ep->old_id = ~0;
  178.           ep->filename = OPENSSL_strdup(filename);
                                ^
  179.           if (bp->last_entry)
  180.               bp->last_entry->next = ep;

crypto/o_str.c:121:1: <Offset trace>
119.   }
120.   
121. > char *CRYPTO_strdup(const char *str, const char* file, int line)
122.   {
123.       char *ret;

crypto/o_str.c:121:1: Parameter `str->strlen`
    119.   }
    120.   
    121. > char *CRYPTO_strdup(const char *str, const char* file, int line)
    122.   {
    123.       char *ret;

crypto/o_str.c:121:1: <Length trace>
119.   }
120.   
121. > char *CRYPTO_strdup(const char *str, const char* file, int line)
122.   {
123.       char *ret;

crypto/o_str.c:121:1: Parameter `str->strlen`
    119.   }
    120.   
    121. > char *CRYPTO_strdup(const char *str, const char* file, int line)
    122.   {
    123.       char *ret;

crypto/o_str.c:127:11: Call
    125.       if (str == NULL)
    126.           return NULL;
    127.       ret = CRYPTO_malloc(strlen(str) + 1, file, line);
                     ^
    128.       if (ret != NULL)
    129.           strcpy(ret, str);

crypto/mem.c:125:9: Assignment
      123.   
      124.       if (num <= 0)
      125.           return NULL;
                     ^
      126.   
      127.       allow_customize = 0;

crypto/o_str.c:127:5: Assignment
    125.       if (str == NULL)
    126.           return NULL;
    127.       ret = CRYPTO_malloc(strlen(str) + 1, file, line);
               ^
    128.       if (ret != NULL)
    129.           strcpy(ret, str);

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

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    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 += app_hex(ch);\n    }\n    if (filename[i++] != '.')\n        return -1;\n    for (type = OSSL_NELEM(suffixes) - 1; type > 0; type--)\n        if (strcasecmp(suffixes[type], &filename[i]) == 0)\n            break;\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 certificate in %s\\n",\n                       opt_getprog(), 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 (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifdef 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;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}']