]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util-ja3: fix AddressSanitizer heap-buffer-overflow
authorMats Klepsland <mats.klepsland@gmail.com>
Sat, 16 Feb 2019 20:49:23 +0000 (21:49 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 20 Feb 2019 13:45:18 +0000 (14:45 +0100)
No resizing is done in Ja3BufferResizeIfFull() when the buffer is
empty. This leads to a potential overflow when this happens, since
a ',' is appended even when the buffer is empty.

Bug #2762

src/util-ja3.c

index eee87a02cf465cc981915500aff2a71b74ed530f..eecf8202452fefec6946c1f06b5e1e4d672df6ec 100644 (file)
@@ -77,10 +77,6 @@ static int Ja3BufferResizeIfFull(JA3Buffer *buffer, uint32_t len)
 {
     DEBUG_VALIDATE_BUG_ON(buffer == NULL);
 
-    if (len == 0) {
-        return 0;
-    }
-
     while (buffer->used + len + 2 > buffer->size)
     {
         buffer->size *= 2;