]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
mcclellan: handle 0 length block scans correctly
authorAlex Coyte <a.coyte@intel.com>
Tue, 3 Jan 2017 01:57:10 +0000 (12:57 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Fri, 6 Jan 2017 00:22:59 +0000 (11:22 +1100)
src/nfa/mcclellan.c

index 584670c235afdc33c5c3bdfea25e7d510c633bcb..6b6848d6395e500f41adb78968d1fbf8e99a54d2 100644 (file)
@@ -375,7 +375,9 @@ char mcclellanExec8_i(const struct mcclellan *m, u32 *state, const u8 *buf,
                       size_t len, u64a offAdj, NfaCallback cb, void *ctxt,
                       char single, const u8 **c_final, enum MatchMode mode) {
     if (!len) {
-        *c_final = buf;
+        if (mode == STOP_AT_MATCH) {
+            *c_final = buf;
+        }
         return MO_ALIVE;
     }
     u32 s = *state;