]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
ssl: fix handshake cert buffer sizing
authorVictor Julien <victor@inliniac.net>
Fri, 3 Apr 2020 15:03:47 +0000 (17:03 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 28 Apr 2020 12:07:54 +0000 (14:07 +0200)
'trec' buffer was not grown properly when it was checked as too small.
After this it wasn't checked again so that copying into the buffer could
overflow it.

src/app-layer-ssl.c

index 8787783d76220ef5d811d350a71e7e3bddeccb27..691a3e7b3cd9333f6f5106953c2c911659fc07fb 100644 (file)
@@ -1408,7 +1408,7 @@ static int SSLv3ParseHandshakeType(SSLState *ssl_state, const uint8_t *input,
             if (ssl_state->curr_connp->trec_pos + input_len >=
                     ssl_state->curr_connp->trec_len) {
                 ssl_state->curr_connp->trec_len =
-                        ssl_state->curr_connp->trec_len + 2 * input_len + 1;
+                        ssl_state->curr_connp->trec_pos + 2 * input_len + 1;
                 ptmp = SCRealloc(ssl_state->curr_connp->trec,
                         ssl_state->curr_connp->trec_len);