mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-19 18:54:23 +03:00
Moves static methods from class String to the namespace string
This commit is contained in:
@@ -90,20 +90,20 @@ int CssDecode::css_decode_inplace(unsigned char *input, int64_t input_len) {
|
||||
switch (j) {
|
||||
/* Number of hex characters */
|
||||
case 1:
|
||||
*d++ = modsecurity::utils::xsingle2c(&input[i]);
|
||||
*d++ = utils::string::xsingle2c(&input[i]);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
/* Use the last two from the end. */
|
||||
*d++ = modsecurity::utils::x2c(&input[i + j - 2]);
|
||||
*d++ = utils::string::x2c(&input[i + j - 2]);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
/* Use the last two from the end, but request
|
||||
* a full width check.
|
||||
*/
|
||||
*d = modsecurity::utils::x2c(&input[i + j - 2]);
|
||||
*d = utils::string::x2c(&input[i + j - 2]);
|
||||
fullcheck = 1;
|
||||
break;
|
||||
|
||||
@@ -112,7 +112,7 @@ int CssDecode::css_decode_inplace(unsigned char *input, int64_t input_len) {
|
||||
* a full width check if the number is greater
|
||||
* or equal to 0xFFFF.
|
||||
*/
|
||||
*d = modsecurity::utils::x2c(&input[i + j - 2]);
|
||||
*d = utils::string::x2c(&input[i + j - 2]);
|
||||
/* Do full check if first byte is 0 */
|
||||
if (input[i] == '0') {
|
||||
fullcheck = 1;
|
||||
@@ -126,7 +126,7 @@ int CssDecode::css_decode_inplace(unsigned char *input, int64_t input_len) {
|
||||
* a full width check if the number is greater
|
||||
* or equal to 0xFFFF.
|
||||
*/
|
||||
*d = modsecurity::utils::x2c(&input[i + j - 2]);
|
||||
*d = utils::string::x2c(&input[i + j - 2]);
|
||||
|
||||
/* Do full check if first/second bytes are 0 */
|
||||
if ((input[i] == '0')
|
||||
|
||||
@@ -92,7 +92,7 @@ int EscapeSeqDecode::ansi_c_sequences_decode_inplace(unsigned char *input,
|
||||
if ((i + 3 < input_len) && (isxdigit(input[i + 2]))
|
||||
&& (isxdigit(input[i + 3]))) {
|
||||
/* Two digits. */
|
||||
c = modsecurity::utils::x2c(&input[i + 2]);
|
||||
c = utils::string::x2c(&input[i + 2]);
|
||||
i += 4;
|
||||
} else {
|
||||
/* Invalid encoding, do nothing. */
|
||||
|
||||
@@ -65,7 +65,7 @@ int HexDecode::inplace(unsigned char *data, int len) {
|
||||
}
|
||||
|
||||
for (i = 0; i <= len - 2; i += 2) {
|
||||
*d++ = modsecurity::utils::x2c(&data[i]);
|
||||
*d++ = utils::string::x2c(&data[i]);
|
||||
count++;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
@@ -72,7 +72,7 @@ int JsDecode::inplace(unsigned char *input, u_int64_t input_len) {
|
||||
/* \uHHHH */
|
||||
|
||||
/* Use only the lower byte. */
|
||||
*d = modsecurity::utils::x2c(&input[i + 4]);
|
||||
*d = utils::string::x2c(&input[i + 4]);
|
||||
|
||||
/* Full width ASCII (ff01 - ff5e) needs 0x20 added */
|
||||
if ((*d > 0x00) && (*d < 0x5f)
|
||||
@@ -87,7 +87,7 @@ int JsDecode::inplace(unsigned char *input, u_int64_t input_len) {
|
||||
} else if ((i + 3 < input_len) && (input[i + 1] == 'x')
|
||||
&& VALID_HEX(input[i + 2]) && VALID_HEX(input[i + 3])) {
|
||||
/* \xHH */
|
||||
*d++ = modsecurity::utils::x2c(&input[i + 2]);
|
||||
*d++ = utils::string::x2c(&input[i + 2]);
|
||||
count++;
|
||||
i += 4;
|
||||
} else if ((i + 1 < input_len) && ISODIGIT(input[i + 1])) {
|
||||
|
||||
@@ -96,7 +96,7 @@ int SqlHexDecode::inplace(unsigned char *data, int len) {
|
||||
}
|
||||
|
||||
while (VALID_HEX(data[0]) && VALID_HEX(data[1])) {
|
||||
*d++ = modsecurity::utils::x2c(data);
|
||||
*d++ = utils::string::x2c(data);
|
||||
data += 2;
|
||||
count += 2;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ int UrlDecodeUni::inplace(unsigned char *input, u_int64_t input_len,
|
||||
} else {
|
||||
/* We first make use of the lower byte here,
|
||||
* ignoring the higher byte. */
|
||||
*d = modsecurity::utils::x2c(&input[i + 4]);
|
||||
*d = utils::string::x2c(&input[i + 4]);
|
||||
|
||||
/* Full width ASCII (ff01 - ff5e)
|
||||
* needs 0x20 added */
|
||||
@@ -153,7 +153,7 @@ int UrlDecodeUni::inplace(unsigned char *input, u_int64_t input_len,
|
||||
char c2 = input[i + 2];
|
||||
|
||||
if (VALID_HEX(c1) && VALID_HEX(c2)) {
|
||||
*d++ = modsecurity::utils::x2c(&input[i + 1]);
|
||||
*d++ = utils::string::x2c(&input[i + 1]);
|
||||
count++;
|
||||
i += 3;
|
||||
} else {
|
||||
|
||||
@@ -69,7 +69,7 @@ std::string UrlEncode::url_enc(const char *input,
|
||||
} else {
|
||||
*d++ = '%';
|
||||
count++;
|
||||
modsecurity::utils::c2x(c, (unsigned char *)d);
|
||||
utils::string::c2x(c, (unsigned char *)d);
|
||||
d += 2;
|
||||
count++;
|
||||
count++;
|
||||
|
||||
@@ -93,7 +93,7 @@ char *Utf8ToUnicode::inplace(unsigned char *input,
|
||||
count++;
|
||||
if (count <= len) {
|
||||
if (c == 0)
|
||||
*data = modsecurity::utils::x2c(&c);
|
||||
*data = utils::string::x2c(&c);
|
||||
else
|
||||
*data++ = c;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user