apps/s_server.c:2873: error: BUFFER_OVERRUN_L1
  Offset: -1 Size: 8192 by call to `SSL_get_shared_ciphers`.
Showing all 6 steps of the trace


apps/s_server.c:2847:1: Array declaration
2845.   }
2846.   
2847. > static void print_connection_info(SSL *con)
2848.   {
2849.       const char *str;

apps/s_server.c:2873:9: Call
2871.       }
2872.   
2873.       if (SSL_get_shared_ciphers(con, buf, sizeof(buf)) != NULL)
                ^
2874.           BIO_printf(bio_s_out, "Shared ciphers:%s\n", buf);
2875.       str = SSL_CIPHER_get_name(SSL_get_current_cipher(con));

ssl/ssl_lib.c:2708:1: <Length trace>
2706.   }
2707.   
2708. > char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size)
2709.   {
2710.       char *p;

ssl/ssl_lib.c:2708:1: Parameter `*buf`
  2706.   }
  2707.   
  2708. > char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size)
  2709.   {
  2710.       char *p;

ssl/ssl_lib.c:2720:5: Assignment
  2718.           return NULL;
  2719.   
  2720.       p = buf;
              ^
  2721.       clntsk = s->peer_ciphers;
  2722.       srvrsk = SSL_get_ciphers(s);

ssl/ssl_lib.c:2748:5: Array access: Offset: -1 Size: 8192 by call to `SSL_get_shared_ciphers` 
  2746.           size -= n + 1;
  2747.       }
  2748.       p[-1] = '\0';
              ^
  2749.       return buf;
  2750.   }

char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size)
{
    char *p;
    STACK_OF(SSL_CIPHER) *clntsk, *srvrsk;
    const SSL_CIPHER *c;
    int i;
    if (!s->server
            || s->peer_ciphers == NULL
            || size < 2)
        return NULL;
    p = buf;
    clntsk = s->peer_ciphers;
    srvrsk = SSL_get_ciphers(s);
    if (clntsk == NULL || srvrsk == NULL)
        return NULL;
    if (sk_SSL_CIPHER_num(clntsk) == 0 || sk_SSL_CIPHER_num(srvrsk) == 0)
        return NULL;
    for (i = 0; i < sk_SSL_CIPHER_num(clntsk); i++) {
        int n;
        c = sk_SSL_CIPHER_value(clntsk, i);
        if (sk_SSL_CIPHER_find(srvrsk, c) < 0)
            continue;
        n = strlen(c->name);
        if (n + 1 > size) {
            if (p != buf)
                --p;
            *p = '\0';
            return buf;
        }
        strcpy(p, c->name);
        p += n;
        *(p++) = ':';
        size -= n + 1;
    }
    p[-1] = '\0';
    return buf;
}
['static void print_connection_info(SSL *con)\n{\n    const char *str;\n    X509 *peer;\n    char buf[BUFSIZ];\n#if !defined(OPENSSL_NO_NEXTPROTONEG)\n    const unsigned char *next_proto_neg;\n    unsigned next_proto_neg_len;\n#endif\n    unsigned char *exportedkeymat;\n    int i;\n    if (s_brief)\n        print_ssl_summary(con);\n    PEM_write_bio_SSL_SESSION(bio_s_out, SSL_get_session(con));\n    peer = SSL_get_peer_certificate(con);\n    if (peer != NULL) {\n        BIO_printf(bio_s_out, "Client certificate\\n");\n        PEM_write_bio_X509(bio_s_out, peer);\n        dump_cert_text(bio_s_out, peer);\n        X509_free(peer);\n        peer = NULL;\n    }\n    if (SSL_get_shared_ciphers(con, buf, sizeof(buf)) != NULL)\n        BIO_printf(bio_s_out, "Shared ciphers:%s\\n", buf);\n    str = SSL_CIPHER_get_name(SSL_get_current_cipher(con));\n    ssl_print_sigalgs(bio_s_out, con);\n#ifndef OPENSSL_NO_EC\n    ssl_print_point_formats(bio_s_out, con);\n    ssl_print_groups(bio_s_out, con, 0);\n#endif\n    print_ca_names(bio_s_out, con);\n    BIO_printf(bio_s_out, "CIPHER is %s\\n", (str != NULL) ? str : "(NONE)");\n#if !defined(OPENSSL_NO_NEXTPROTONEG)\n    SSL_get0_next_proto_negotiated(con, &next_proto_neg, &next_proto_neg_len);\n    if (next_proto_neg) {\n        BIO_printf(bio_s_out, "NEXTPROTO is ");\n        BIO_write(bio_s_out, next_proto_neg, next_proto_neg_len);\n        BIO_printf(bio_s_out, "\\n");\n    }\n#endif\n#ifndef OPENSSL_NO_SRTP\n    {\n        SRTP_PROTECTION_PROFILE *srtp_profile\n            = SSL_get_selected_srtp_profile(con);\n        if (srtp_profile)\n            BIO_printf(bio_s_out, "SRTP Extension negotiated, profile=%s\\n",\n                       srtp_profile->name);\n    }\n#endif\n    if (SSL_session_reused(con))\n        BIO_printf(bio_s_out, "Reused session-id\\n");\n    BIO_printf(bio_s_out, "Secure Renegotiation IS%s supported\\n",\n               SSL_get_secure_renegotiation_support(con) ? "" : " NOT");\n    if ((SSL_get_options(con) & SSL_OP_NO_RENEGOTIATION))\n        BIO_printf(bio_s_out, "Renegotiation is DISABLED\\n");\n    if (keymatexportlabel != NULL) {\n        BIO_printf(bio_s_out, "Keying material exporter:\\n");\n        BIO_printf(bio_s_out, "    Label: \'%s\'\\n", keymatexportlabel);\n        BIO_printf(bio_s_out, "    Length: %i bytes\\n", keymatexportlen);\n        exportedkeymat = app_malloc(keymatexportlen, "export key");\n        if (!SSL_export_keying_material(con, exportedkeymat,\n                                        keymatexportlen,\n                                        keymatexportlabel,\n                                        strlen(keymatexportlabel),\n                                        NULL, 0, 0)) {\n            BIO_printf(bio_s_out, "    Error\\n");\n        } else {\n            BIO_printf(bio_s_out, "    Keying material: ");\n            for (i = 0; i < keymatexportlen; i++)\n                BIO_printf(bio_s_out, "%02X", exportedkeymat[i]);\n            BIO_printf(bio_s_out, "\\n");\n        }\n        OPENSSL_free(exportedkeymat);\n    }\n#ifndef OPENSSL_NO_KTLS\n    if (BIO_get_ktls_send(SSL_get_wbio(con)))\n        BIO_printf(bio_err, "Using Kernel TLS for sending\\n");\n    if (BIO_get_ktls_recv(SSL_get_rbio(con)))\n        BIO_printf(bio_err, "Using Kernel TLS for receiving\\n");\n#endif\n    (void)BIO_flush(bio_s_out);\n}', "char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size)\n{\n    char *p;\n    STACK_OF(SSL_CIPHER) *clntsk, *srvrsk;\n    const SSL_CIPHER *c;\n    int i;\n    if (!s->server\n            || s->peer_ciphers == NULL\n            || size < 2)\n        return NULL;\n    p = buf;\n    clntsk = s->peer_ciphers;\n    srvrsk = SSL_get_ciphers(s);\n    if (clntsk == NULL || srvrsk == NULL)\n        return NULL;\n    if (sk_SSL_CIPHER_num(clntsk) == 0 || sk_SSL_CIPHER_num(srvrsk) == 0)\n        return NULL;\n    for (i = 0; i < sk_SSL_CIPHER_num(clntsk); i++) {\n        int n;\n        c = sk_SSL_CIPHER_value(clntsk, i);\n        if (sk_SSL_CIPHER_find(srvrsk, c) < 0)\n            continue;\n        n = strlen(c->name);\n        if (n + 1 > size) {\n            if (p != buf)\n                --p;\n            *p = '\\0';\n            return buf;\n        }\n        strcpy(p, c->name);\n        p += n;\n        *(p++) = ':';\n        size -= n + 1;\n    }\n    p[-1] = '\\0';\n    return buf;\n}"]