]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Fix lowercase table initialization (bug 1221)
authorKen Steele <ken@tilera.com>
Tue, 24 Jun 2014 18:43:58 +0000 (14:43 -0400)
committerVictor Julien <victor@inliniac.net>
Mon, 30 Jun 2014 15:29:41 +0000 (17:29 +0200)
The for loop needed to check for < 256, not < 255.

src/suricata.c
src/util-mpm-ac.c
src/util-mpm-wumanber.c

index 4117492a55ebc1c8998cb9e714c66fee80c1c45b..bcba8dcbf850f9e68300875b3f472fd5e452ce3b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2013 Open Information Security Foundation
+/* Copyright (C) 2007-2014 Open Information Security Foundation
  *
  * You can copy, redistribute or modify this Program under the terms of
  * the GNU General Public License version 2 as published by the Free
@@ -346,9 +346,9 @@ void CreateLowercaseTable()
 {
     /* create table for O(1) lowercase conversion lookup.  It was removed, but
      * we still need it for cuda.  So resintalling it back into the codebase */
-    uint8_t c = 0;
+    int c = 0;
     memset(g_u8_lowercasetable, 0x00, sizeof(g_u8_lowercasetable));
-    for ( ; c < 255; c++) {
+    for ( ; c < 256; c++) {
         if (c >= 'A' && c <= 'Z')
             g_u8_lowercasetable[c] = (c + ('a' - 'A'));
         else
index 800e3db9f35ae7ab8d27946fb38a7485c8ba7ffa..a181da102cb7ae82bff8185a8ac86ea0d2eb139c 100644 (file)
@@ -1711,7 +1711,7 @@ static void *SCACCudaDispatcher(void *arg)
 #endif
 
     uint8_t g_u8_lowercasetable[256];
-    for (uint8_t c = 0; c < 255; c++)
+    for (int c = 0; c < 256; c++)
         g_u8_lowercasetable[c] = tolower((uint8_t)c);
     CUdeviceptr cuda_g_u8_lowercasetable_d = 0;
     CUdeviceptr cuda_packets_buffer_d = 0;
index 80d1d1581e9bf60dc1bdc55d6049cdb8cf610537..648da6a30b95f29539dab98b281cd65f57784147 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2014 Open Information Security Foundation
  *
  * You can copy, redistribute or modify this Program under the terms of
  * the GNU General Public License version 2 as published by the Free
@@ -1441,8 +1441,8 @@ void MpmWuManberRegister (void) {
     mpm_table[MPM_WUMANBER].RegisterUnittests = WmRegisterTests;
 
     /* create table for O(1) lowercase conversion lookup */
-    uint8_t c = 0;
-    for ( ; c < 255; c++) {
+    int c = 0;
+    for ( ; c < 256; c++) {
        if (c >= 'A' && c <= 'Z')
            lowercasetable[c] = (c + ('a' - 'A'));
        else