mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 11:44:32 +03:00
Encapsulates int[N] in a class to avoid compilation issues
Depending on the compiler, there may be a compilation issue with the usage of std::unique_ptr<int[]>. Therefore encapsulating it inside a regular class.
This commit is contained in:
@@ -109,7 +109,7 @@ int UrlDecodeUni::inplace(unsigned char *input, uint64_t input_len,
|
||||
|
||||
if (Code >= 0 && Code <= 65535) {
|
||||
Rules *r = t->m_rules;
|
||||
hmap = r->m_unicodeMapTable.m_unicodeMapTable[Code];
|
||||
hmap = r->m_unicodeMapTable.m_unicodeMapTable->at(Code);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -40,20 +40,17 @@ void ConfigUnicodeMap::loadConfig(std::string f, double configCodePage,
|
||||
driver->m_unicodeMapTable.m_set = true;
|
||||
driver->m_unicodeMapTable.m_unicodeCodePage = configCodePage;
|
||||
|
||||
std::unique_ptr<int[]> a(new int[65536], std::default_delete<int[]>());
|
||||
driver->m_unicodeMapTable.m_unicodeMapTable = std::move(a);
|
||||
memset(driver->m_unicodeMapTable.m_unicodeMapTable.get(), -1,
|
||||
(sizeof(int)*65536));
|
||||
driver->m_unicodeMapTable.m_unicodeMapTable.reset(new modsecurity::UnicodeMapHolder());
|
||||
|
||||
/* Setting some unicode values - http://tools.ietf.org/html/rfc3490#section-3.1 */
|
||||
/* Set 0x3002 -> 0x2e */
|
||||
driver->m_unicodeMapTable.m_unicodeMapTable[0x3002] = 0x2e;
|
||||
driver->m_unicodeMapTable.m_unicodeMapTable->change(0x3002, 0x2e);
|
||||
/* Set 0xFF61 -> 0x2e */
|
||||
driver->m_unicodeMapTable.m_unicodeMapTable[0xff61] = 0x2e;
|
||||
driver->m_unicodeMapTable.m_unicodeMapTable->change(0xff61, 0x2e);
|
||||
/* Set 0xFF0E -> 0x2e */
|
||||
driver->m_unicodeMapTable.m_unicodeMapTable[0xff0e] = 0x2e;
|
||||
driver->m_unicodeMapTable.m_unicodeMapTable->change(0xff0e, 0x2e);
|
||||
/* Set 0x002E -> 0x2e */
|
||||
driver->m_unicodeMapTable.m_unicodeMapTable[0x002e] = 0x2e;
|
||||
driver->m_unicodeMapTable.m_unicodeMapTable->change(0x002e, 0x2e);
|
||||
|
||||
|
||||
std::ifstream file_stream(f, std::ios::in | std::ios::binary);
|
||||
@@ -106,7 +103,7 @@ void ConfigUnicodeMap::loadConfig(std::string f, double configCodePage,
|
||||
sscanf(ucode, "%x", &code);
|
||||
sscanf(hmap, "%x", &Map);
|
||||
if (code >= 0 && code <= 65535) {
|
||||
driver->m_unicodeMapTable.m_unicodeMapTable[code] = Map;
|
||||
driver->m_unicodeMapTable.m_unicodeMapTable->change(code, Map);
|
||||
}
|
||||
|
||||
free(mapping);
|
||||
|
Reference in New Issue
Block a user