Skip to content

Commit 9768749

Browse files
authored
Merge pull request owasp-modsecurity#3098 from devzero2000/ep/scoped-for
Ep/scoped for: second pr
2 parents 734646d + 2daebc0 commit 9768749

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

src/actions/transformations/hex_decode.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ std::string HexDecode::evaluate(const std::string &value,
5858

5959
int HexDecode::inplace(unsigned char *data, int len) {
6060
unsigned char *d = data;
61-
int i, count = 0;
61+
int count = 0;
6262

6363
if ((data == NULL) || (len == 0)) {
6464
return 0;
6565
}
6666

67-
for (i = 0; i <= len - 2; i += 2) {
67+
for (int i = 0;i <= len - 2;i += 2) {
6868
*d++ = utils::string::x2c(&data[i]);
6969
count++;
7070
}

src/operators/verify_cc.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ int VerifyCC::luhnVerify(const char *ccnumber, int len) {
5959
int sum[2] = { 0, 0 };
6060
int odd = 0;
6161
int digits = 0;
62-
int i;
6362

6463
/* Weighted lookup table which is just a precalculated (i = index):
6564
* i*2 + (( (i*2) > 9 ) ? -9 : 0)
@@ -71,7 +70,7 @@ int VerifyCC::luhnVerify(const char *ccnumber, int len) {
7170
/* Add up only digits (weighted digits via lookup table)
7271
* for both odd and even CC numbers to avoid 2 passes.
7372
*/
74-
for (i = 0; i < len; i++) {
73+
for (int i = 0;i < len;i++) {
7574
if (ccnumber[i] >= (0 + 48) && ccnumber[i] <= (9 + 48)) {
7675
sum[0] += (!odd ? wtable[ccnumber[i] - '0'] : (ccnumber[i] - '0'));
7776
sum[1] += (odd ? wtable[ccnumber[i] - '0'] : (ccnumber[i] - '0'));

src/request_body_processor/multipart.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ int Multipart::boundary_characters_valid(const char *boundary) {
231231

232232

233233
void Multipart::validate_quotes(const char *data, char quote) {
234-
int i, len;
234+
int len;
235235

236236
if (data == NULL)
237237
return;
@@ -244,7 +244,7 @@ void Multipart::validate_quotes(const char *data, char quote) {
244244

245245
len = strlen(data);
246246

247-
for (i = 0; i < len; i++) {
247+
for (int i = 0;i < len;i++) {
248248
if (data[i] == '\'') {
249249
ms_dbg_a(m_transaction, 9,
250250
"Multipart: Invalid quoting detected: " \

src/utils/acmp.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,9 @@ static size_t acmp_strlen(ACMP *parser, const char *str) {
190190
* len - length of input string
191191
*/
192192
static void acmp_strtoucs(ACMP *parser, const char *str, long *ucs_chars, int len) {
193-
int i;
194193
const char *c = str;
195194

196-
for (i = 0; i < len; i++) {
195+
for (int i = 0;i < len;i++) {
197196
*(ucs_chars++) = *(c++);
198197
}
199198
}

0 commit comments

Comments
 (0)