Commit e70b6db7 authored by Robert David Graham's avatar Robert David Graham
Browse files

#94 crash in SSL selftest

parent 48b1488a
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ struct Banner1
    struct ProtocolParserStream *tcp_payloads[65536];
};

struct BanBase64
struct BannerBase64
{
    unsigned state:2;
    unsigned temp:24;
@@ -43,13 +43,12 @@ struct SSL_SERVER_CERT {
    unsigned remaining;
    struct {
        unsigned remaining;
        struct BanBase64 base64;
    } sub;
    struct CertDecode x509;
};

struct SSLRECORD {
    unsigned char content_type;
    unsigned char type;
    unsigned char version_major;
    unsigned char version_minor;

@@ -57,7 +56,7 @@ struct SSLRECORD {
        unsigned state;
        unsigned char type;
        unsigned remaining;
    } record;
    } handshake;

    union {
        struct {
@@ -78,6 +77,8 @@ struct ProtocolState {
    unsigned short port;
    unsigned short app_proto;
    unsigned is_sent_sslhello:1;
    struct BannerBase64 base64;

    union {
        struct SSLRECORD ssl;
    } sub;
+4 −4
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ static const char *b64 =
/*****************************************************************************
 *****************************************************************************/
void
banout_init_base64(struct BanBase64 *base64)
banout_init_base64(struct BannerBase64 *base64)
{
    base64->state = 0;
    base64->temp = 0;
@@ -215,7 +215,7 @@ banout_init_base64(struct BanBase64 *base64)
void
banout_append_base64(struct BannerOutput *banout, unsigned proto,
                     const void *vpx, size_t length,
                     struct BanBase64 *base64)
                     struct BannerBase64 *base64)
{
    const unsigned char *px = (const unsigned char *)vpx;
    size_t i;
@@ -250,7 +250,7 @@ banout_append_base64(struct BannerOutput *banout, unsigned proto,
 *****************************************************************************/
void
banout_finalize_base64(struct BannerOutput *banout, unsigned proto,
                       struct BanBase64 *base64)
                       struct BannerBase64 *base64)
{
    unsigned x = base64->temp;
    switch (base64->state) {
@@ -326,7 +326,7 @@ banout_selftest(void)
     */
    {
        struct BannerOutput banout[1];
        struct BanBase64 base64[1];
        struct BannerBase64 base64[1];
    
        banout_init(banout);

+4 −4
Original line number Diff line number Diff line
#ifndef PROTO_BANOUT_H
#define PROTO_BANOUT_H
struct BanBase64;
struct BannerBase64;

/**
 * A structure for tracking one or more banners from a target.
@@ -82,7 +82,7 @@ banout_string_length(const struct BannerOutput *banout, unsigned proto);
 * Prepare to start calling banout_append_base64()
 */
void
banout_init_base64(struct BanBase64 *base64);
banout_init_base64(struct BannerBase64 *base64);

/**
 * Converts the string to BASE64 and appends it to the banner.
@@ -94,7 +94,7 @@ banout_init_base64(struct BanBase64 *base64);
void
banout_append_base64(struct BannerOutput *banout, unsigned proto,
                     const void *px, size_t length,
                     struct BanBase64 *base64);
                     struct BannerBase64 *base64);

/**
 * Finish encoding the BASE64 string, appending the '==' things on the
@@ -102,7 +102,7 @@ banout_append_base64(struct BannerOutput *banout, unsigned proto,
 */
void
banout_finalize_base64(struct BannerOutput *banout, unsigned proto,
                       struct BanBase64 *base64);
                       struct BannerBase64 *base64);

/**
 * Do the typical unit/regression test, for this module.
+375 −157

File changed.

Preview size limit exceeded, changes collapsed.