From: Mats Klepsland Date: Sat, 16 Feb 2019 20:49:23 +0000 (+0100) Subject: util-ja3: fix AddressSanitizer heap-buffer-overflow X-Git-Tag: suricata-5.0.0-beta1~205 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22d8fc802e405d3aa61d557555b313410de120a0;p=thirdparty%2Fsuricata.git util-ja3: fix AddressSanitizer heap-buffer-overflow 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 --- diff --git a/src/util-ja3.c b/src/util-ja3.c index eee87a02cf..eecf820245 100644 --- a/src/util-ja3.c +++ b/src/util-ja3.c @@ -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;