Fix lowercase table initialization (bug 1221)

The for loop needed to check for < 256, not < 255.
pull/1001/merge
Ken Steele 12 years ago committed by Victor Julien
parent 1419e400a1
commit f2e777e3a5

@ -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 * You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free * 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 /* 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 */ * 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)); memset(g_u8_lowercasetable, 0x00, sizeof(g_u8_lowercasetable));
for ( ; c < 255; c++) { for ( ; c < 256; c++) {
if (c >= 'A' && c <= 'Z') if (c >= 'A' && c <= 'Z')
g_u8_lowercasetable[c] = (c + ('a' - 'A')); g_u8_lowercasetable[c] = (c + ('a' - 'A'));
else else

@ -1711,7 +1711,7 @@ static void *SCACCudaDispatcher(void *arg)
#endif #endif
uint8_t g_u8_lowercasetable[256]; 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); g_u8_lowercasetable[c] = tolower((uint8_t)c);
CUdeviceptr cuda_g_u8_lowercasetable_d = 0; CUdeviceptr cuda_g_u8_lowercasetable_d = 0;
CUdeviceptr cuda_packets_buffer_d = 0; CUdeviceptr cuda_packets_buffer_d = 0;

@ -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 * You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free * 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; mpm_table[MPM_WUMANBER].RegisterUnittests = WmRegisterTests;
/* create table for O(1) lowercase conversion lookup */ /* create table for O(1) lowercase conversion lookup */
uint8_t c = 0; int c = 0;
for ( ; c < 255; c++) { for ( ; c < 256; c++) {
if (c >= 'A' && c <= 'Z') if (c >= 'A' && c <= 'Z')
lowercasetable[c] = (c + ('a' - 'A')); lowercasetable[c] = (c + ('a' - 'A'));
else else

Loading…
Cancel
Save