]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
fdr: ensure 16 bytes of pre-history in block mode
authorJustin Viiret <justin.viiret@intel.com>
Mon, 9 May 2016 23:32:13 +0000 (09:32 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 18 May 2016 06:28:27 +0000 (16:28 +1000)
src/fdr/fdr.c

index 51a041cc98e02d7886a2b804a86e0cc6c4dee4f6..ff69853e29f5c7b70f5d5929f031525cb83e0791 100644 (file)
@@ -800,12 +800,16 @@ static const u8 fake_history[FAKE_HISTORY_SIZE];
 hwlm_error_t fdrExec(const struct FDR *fdr, const u8 *buf, size_t len,
                      size_t start, HWLMCallback cb, void *ctxt,
                      hwlm_group_t groups) {
+    // We guarantee (for safezone construction) that it is safe to read 16
+    // bytes before the end of the history buffer.
+    const u8 *hbuf = fake_history + FAKE_HISTORY_SIZE;
+
     const struct FDR_Runtime_Args a = {
         buf,
         len,
-        fake_history,
+        hbuf,
         0,
-        fake_history, // nocase
+        hbuf, // nocase
         0,
         start,
         cb,