]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
transform/base64: check for 0-sized buffer
authorPhilippe Antoine <pantoine@oisf.net>
Wed, 2 Oct 2024 18:39:26 +0000 (20:39 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 8 Oct 2024 11:02:49 +0000 (13:02 +0200)
So as to avoid undefined behavior with a 0-sized variable length
array

Ticket: #7296

src/detect-transform-base64.c

index f8d8f6e241b8b91345c07e26348443895158434c..e0fbdeeb44d6b41a3f0eae5aafbdd891a5bc462f 100644 (file)
@@ -141,6 +141,9 @@ static void TransformFromBase64Decode(InspectionBuffer *buffer, void *options)
         }
         decode_length = nbytes;
     }
+    if (decode_length == 0) {
+        return;
+    }
 
     uint32_t decoded_size = Base64DecodeBufferSize(decode_length);
     uint8_t decoded[decoded_size];