]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
tls: fix off by one in supported versions extension 8374/head
authorPhilippe Antoine <pantoine@oisf.net>
Fri, 11 Nov 2022 10:52:27 +0000 (11:52 +0100)
committerVictor Julien <vjulien@oisf.net>
Fri, 13 Jan 2023 11:33:04 +0000 (12:33 +0100)
Ticket: #5663
(cherry picked from commit b5147189aecd1d49520e6dc9b40b1baca5a4f503)

src/app-layer-ssl.c

index 306adba714267beca2f9dbdc730f3ac95f5963c1..2bb69e89f659edab6a3bcd025c3ca5bf815556f8 100644 (file)
@@ -1006,7 +1006,7 @@ static inline int TLSDecodeHSHelloExtensionSupportedVersions(SSLState *ssl_state
         /* Use the first (and prefered) valid version as client version,
          * skip over GREASE and other possible noise. */
         uint16_t i = 0;
-        while (i < (uint16_t)supported_ver_len) {
+        while (i + 1 < (uint16_t)supported_ver_len) {
             uint16_t ver = (uint16_t)(input[i] << 8) | input[i + 1];
             if (TLSVersionValid(ver)) {
                 ssl_state->curr_connp->version = ver;