]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
tls: don't set event on small input data
authorVictor Julien <victor@inliniac.net>
Fri, 29 Sep 2017 17:10:46 +0000 (19:10 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 3 Oct 2017 08:46:03 +0000 (10:46 +0200)
On very small data the max loop count could be 0. Make sure
it's always at least 1.

src/app-layer-ssl.c

index f6b4d23eea0e61291d67d208a6f96173dc6b7ace..1b4c0beec618f241d26489262207fe9dd8cc753f 100644 (file)
@@ -1418,7 +1418,7 @@ static int SSLDecode(Flow *f, uint8_t direction, void *alstate, AppLayerParserSt
     }
 
     /* if we have more than one record */
-    uint32_t max_records = input_len / SSL_RECORD_MINIMUM_LENGTH;
+    uint32_t max_records = MAX((input_len / SSL_RECORD_MINIMUM_LENGTH),1);
     while (input_len > 0) {
         if (counter > max_records) {
             SCLogDebug("Looks like we have looped quite a bit. Reset state "