ssl/statem/extensions_clnt.c:518: error: BUFFER_OVERRUN_L3
  Offset: [-1, +oo] Size: 29 by call to `tls_curve_allowed`.
Showing all 7 steps of the trace


ssl/statem/extensions_clnt.c:487:1: Parameter `*s->session->tlsext_supportedgroupslist`
485.   
486.   
487. > int tls_construct_client_key_share(SSL *s, WPACKET *pkt, int *al)
488.   {
489.       size_t i, sharessent = 0, num_curves = 0;

ssl/statem/extensions_clnt.c:518:14: Call
516.           size_t encodedlen;
517.   
518.           if (!tls_curve_allowed(s, pcurves, SSL_SECOP_CURVE_SUPPORTED))
                    ^
519.               continue;
520.   

ssl/t1_lib.c:309:1: <Offset trace>
307.   
308.   /* See if curve is allowed by security callback */
309. > int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)
310.   {
311.       const tls_curve_info *cinfo;

ssl/t1_lib.c:309:1: Parameter `*curve`
  307.   
  308.   /* See if curve is allowed by security callback */
  309. > int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)
  310.   {
  311.       const tls_curve_info *cinfo;

ssl/t1_lib.c:141:1: <Length trace>
139.    * table: the index of each entry is one less than the TLS curve id.
140.    */
141. > static const tls_curve_info nid_list[] = {
142.       {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */
143.       {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */

ssl/t1_lib.c:141:1: Array declaration
  139.    * table: the index of each entry is one less than the TLS curve id.
  140.    */
  141. > static const tls_curve_info nid_list[] = {
  142.       {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */
  143.       {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */

ssl/t1_lib.c:316:5: Array access: Offset: [-1, +oo] Size: 29 by call to `tls_curve_allowed` 
  314.       if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list)))
  315.           return 0;
  316.       cinfo = &nid_list[curve[1] - 1];
             ^
  317.   # ifdef OPENSSL_NO_EC2M
  318.       if (cinfo->flags & TLS_CURVE_CHAR2)

int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)
{
    const tls_curve_info *cinfo;
    if (curve[0])
        return 1;
    if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list)))
        return 0;
    cinfo = &nid_list[curve[1] - 1];
# ifdef OPENSSL_NO_EC2M
    if (cinfo->flags & TLS_CURVE_CHAR2)
        return 0;
# endif
    return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve);
}
['int tls_construct_client_key_share(SSL *s, WPACKET *pkt, int *al)\n{\n    size_t i, sharessent = 0, num_curves = 0;\n    const unsigned char *pcurves = NULL;\n    if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_key_share)\n            || !WPACKET_start_sub_packet_u16(pkt)\n            || !WPACKET_start_sub_packet_u16(pkt)) {\n        SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_SHARE, ERR_R_INTERNAL_ERROR);\n        return 0;\n    }\n    pcurves = s->tlsext_supportedgroupslist;\n    if (!tls1_get_curvelist(s, 0, &pcurves, &num_curves)) {\n        SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_SHARE, ERR_R_INTERNAL_ERROR);\n        return 0;\n    }\n    for (i = 0; i < num_curves && sharessent < 1; i++, pcurves += 2) {\n        unsigned char *encodedPoint = NULL;\n        unsigned int curve_id = 0;\n        EVP_PKEY *key_share_key = NULL;\n        size_t encodedlen;\n        if (!tls_curve_allowed(s, pcurves, SSL_SECOP_CURVE_SUPPORTED))\n            continue;\n        if (s->s3->tmp.pkey != NULL) {\n            SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_SHARE, ERR_R_INTERNAL_ERROR);\n            return 0;\n        }\n        curve_id = (pcurves[0] << 8) | pcurves[1];\n        key_share_key = ssl_generate_pkey_curve(curve_id);\n        if (key_share_key == NULL) {\n            SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_SHARE, ERR_R_EVP_LIB);\n            return 0;\n        }\n        encodedlen = EVP_PKEY_get1_tls_encodedpoint(key_share_key,\n                                                    &encodedPoint);\n        if (encodedlen == 0) {\n            SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_SHARE, ERR_R_EC_LIB);\n            EVP_PKEY_free(key_share_key);\n            return 0;\n        }\n        if (!WPACKET_put_bytes_u16(pkt, curve_id)\n                || !WPACKET_sub_memcpy_u16(pkt, encodedPoint, encodedlen)) {\n            SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_SHARE, ERR_R_INTERNAL_ERROR);\n            EVP_PKEY_free(key_share_key);\n            OPENSSL_free(encodedPoint);\n            return 0;\n        }\n        s->s3->group_id = curve_id;\n        s->s3->tmp.pkey = key_share_key;\n        sharessent++;\n        OPENSSL_free(encodedPoint);\n    }\n    if (!WPACKET_close(pkt) || !WPACKET_close(pkt)) {\n        SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_SHARE, ERR_R_INTERNAL_ERROR);\n        return 0;\n    }\n    return 1;\n}', 'int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)\n{\n    const tls_curve_info *cinfo;\n    if (curve[0])\n        return 1;\n    if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list)))\n        return 0;\n    cinfo = &nid_list[curve[1] - 1];\n# ifdef OPENSSL_NO_EC2M\n    if (cinfo->flags & TLS_CURVE_CHAR2)\n        return 0;\n# endif\n    return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve);\n}']