ssl/t1_ext.c:240: error: BUFFER_OVERRUN_S2
  Offset added: [`exts->meths_count` + 48, `exts->meths_count` + 48] (⇐ `exts->meths_count` + 48) Size: [1, 48⋅`exts->meths_count` + 48].
Showing all 6 steps of the trace


ssl/t1_ext.c:203:1: <Length trace>
201.   
202.   /* Set callbacks for a custom extension. */
203. > static int custom_ext_meth_add(custom_ext_methods *exts,
204.                                  unsigned int ext_type,
205.                                  custom_ext_add_cb add_cb,

ssl/t1_ext.c:203:1: Parameter `exts->meths_count`
201.   
202.   /* Set callbacks for a custom extension. */
203. > static int custom_ext_meth_add(custom_ext_methods *exts,
204.                                  unsigned int ext_type,
205.                                  custom_ext_add_cb add_cb,

ssl/t1_ext.c:228:9: Call
226.           return 0;
227.       /* Search for duplicate */
228.       if (custom_ext_find(exts, ext_type))
               ^
229.           return 0;
230.       exts->meths = OPENSSL_realloc(exts->meths,

ssl/t1_ext.c:64:1: Parameter `exts->meths_count`
  62.   
  63.   /* Find a custom extension from the list. */
  64. > static custom_ext_method *custom_ext_find(const custom_ext_methods *exts,
  65.                                             unsigned int ext_type)
  66.   {

ssl/t1_ext.c:239:5: Assignment
237.       }
238.   
239.       meth = exts->meths + exts->meths_count;
           ^
240.       memset(meth, 0, sizeof(*meth));
241.       meth->parse_cb = parse_cb;

ssl/t1_ext.c:240:5: Array access: Offset added: [exts->meths_count + 48, exts->meths_count + 48] (⇐ exts->meths_count + 48) Size: [1, 48⋅exts->meths_count + 48]
238.   
239.       meth = exts->meths + exts->meths_count;
240.       memset(meth, 0, sizeof(*meth));
           ^
241.       meth->parse_cb = parse_cb;
242.       meth->add_cb = add_cb;

static int custom_ext_meth_add(custom_ext_methods *exts,
                               unsigned int ext_type,
                               custom_ext_add_cb add_cb,
                               custom_ext_free_cb free_cb,
                               void *add_arg,
                               custom_ext_parse_cb parse_cb, void *parse_arg)
{
    custom_ext_method *meth;
    if (!add_cb && free_cb)
        return 0;
    if (SSL_extension_supported(ext_type) &&
        ext_type != TLSEXT_TYPE_signed_certificate_timestamp)
        return 0;
    if (ext_type > 0xffff)
        return 0;
    if (custom_ext_find(exts, ext_type))
        return 0;
    exts->meths = OPENSSL_realloc(exts->meths,
                                  (exts->meths_count +
                                   1) * sizeof(custom_ext_method));
    if (!exts->meths) {
        exts->meths_count = 0;
        return 0;
    }
    meth = exts->meths + exts->meths_count;
    memset(meth, 0, sizeof(*meth));
    meth->parse_cb = parse_cb;
    meth->add_cb = add_cb;
    meth->free_cb = free_cb;
    meth->ext_type = ext_type;
    meth->add_arg = add_arg;
    meth->parse_arg = parse_arg;
    exts->meths_count++;
    return 1;
}
['static int custom_ext_meth_add(custom_ext_methods *exts,\n                               unsigned int ext_type,\n                               custom_ext_add_cb add_cb,\n                               custom_ext_free_cb free_cb,\n                               void *add_arg,\n                               custom_ext_parse_cb parse_cb, void *parse_arg)\n{\n    custom_ext_method *meth;\n    if (!add_cb && free_cb)\n        return 0;\n    if (SSL_extension_supported(ext_type) &&\n        ext_type != TLSEXT_TYPE_signed_certificate_timestamp)\n        return 0;\n    if (ext_type > 0xffff)\n        return 0;\n    if (custom_ext_find(exts, ext_type))\n        return 0;\n    exts->meths = OPENSSL_realloc(exts->meths,\n                                  (exts->meths_count +\n                                   1) * sizeof(custom_ext_method));\n    if (!exts->meths) {\n        exts->meths_count = 0;\n        return 0;\n    }\n    meth = exts->meths + exts->meths_count;\n    memset(meth, 0, sizeof(*meth));\n    meth->parse_cb = parse_cb;\n    meth->add_cb = add_cb;\n    meth->free_cb = free_cb;\n    meth->ext_type = ext_type;\n    meth->add_arg = add_arg;\n    meth->parse_arg = parse_arg;\n    exts->meths_count++;\n    return 1;\n}', 'static custom_ext_method *custom_ext_find(const custom_ext_methods *exts,\n                                          unsigned int ext_type)\n{\n    size_t i;\n    custom_ext_method *meth = exts->meths;\n    for (i = 0; i < exts->meths_count; i++, meth++) {\n        if (ext_type == meth->ext_type)\n            return meth;\n    }\n    return NULL;\n}']