From 371113e21e808b74cfbb0878ed14e08a3b926d5c Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 31 May 2016 16:58:29 +0200 Subject: [PATCH] ac-ks: don't allow use on big-endian --- src/detect-engine-mpm.c | 7 +++++++ src/util-mpm-ac-tile.c | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/detect-engine-mpm.c b/src/detect-engine-mpm.c index fe469b4a08..dafa2b3a8b 100644 --- a/src/detect-engine-mpm.c +++ b/src/detect-engine-mpm.c @@ -335,6 +335,13 @@ uint16_t PatternMatchDefaultMatcher(void) uint16_t u; if (mpm_algo != NULL) { +#if __BYTE_ORDER == __BIG_ENDIAN + if (strcmp(mpm_algo, "ac-ks") == 0) { + SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "ac-ks does " + "not work on big endian systems at this time."); + exit(EXIT_FAILURE); + } +#endif if (strcmp("auto", mpm_algo) == 0) { goto done; } diff --git a/src/util-mpm-ac-tile.c b/src/util-mpm-ac-tile.c index 425d223766..62fda87e10 100644 --- a/src/util-mpm-ac-tile.c +++ b/src/util-mpm-ac-tile.c @@ -68,6 +68,8 @@ #include "suricata-common.h" #include "suricata.h" +#if __BYTE_ORDER == __LITTLE_ENDIAN + #include "detect.h" #include "detect-parse.h" #include "detect-engine.h" @@ -2569,3 +2571,11 @@ void SCACTileRegisterTests(void) #endif } +#else /* we're big endian */ + +void MpmACTileRegister(void) +{ + /* no-op on big endian */ +} + +#endif /* little endian check */