... | ... |
@@ -1151,8 +1151,8 @@ int scanmanager(const struct optstruct *opts) |
1151 | 1151 |
} |
1152 | 1152 |
} |
1153 | 1153 |
|
1154 |
- if((opt = optget(opts, "structured-cc-mode"))->active) { |
|
1155 |
- switch(opt->numarg) { |
|
1154 |
+ if ((opt = optget(opts, "structured-cc-mode"))->active) { |
|
1155 |
+ switch (opt->numarg) { |
|
1156 | 1156 |
case 0: |
1157 | 1157 |
break; |
1158 | 1158 |
case 1: |
... | ... |
@@ -152,10 +152,9 @@ static struct iin_map_struct iin_map[] = { |
152 | 152 |
{624000, 626999, 16, 16, 1, 1, "China Union Pay"}, |
153 | 153 |
{628200, 628899, 16, 16, 1, 1, "China Union Pay"}, |
154 | 154 |
{644000, 659999, 16, 16, 1, 1, "Discover 2009"}, |
155 |
- {0} |
|
156 |
-}; |
|
155 |
+ {0}}; |
|
157 | 156 |
|
158 |
-static const struct iin_map_struct * get_iin(char * digits, int cc_only) |
|
157 |
+static const struct iin_map_struct *get_iin(char *digits, int cc_only) |
|
159 | 158 |
{ |
160 | 159 |
uint32_t iin = atoi(digits); |
161 | 160 |
int i = 0; |
... | ... |
@@ -221,7 +220,7 @@ int dlp_is_valid_cc(const unsigned char *buffer, size_t length, int cc_only) |
221 | 221 |
|
222 | 222 |
/* Look for the remaining needed digits. */ |
223 | 223 |
for (/*same 'i' from previous for-loop*/; i < length && digits < iin->card_max; i++) { |
224 |
- if (isdigit(buffer[i]) == 0) { |
|
224 |
+ if (isdigit(buffer[i]) == 0) { |
|
225 | 225 |
if (buffer[i] == ' ' || buffer[i] == '-') |
226 | 226 |
if (pad_allowance-- > 0) |
227 | 227 |
continue; |
... | ... |
@@ -232,9 +231,9 @@ int dlp_is_valid_cc(const unsigned char *buffer, size_t length, int cc_only) |
232 | 232 |
} |
233 | 233 |
|
234 | 234 |
if (digits < iin->card_min || (i < length && isdigit(buffer[i]))) |
235 |
- return 0; |
|
235 |
+ return 0; |
|
236 | 236 |
|
237 |
- j = (ssize_t) i; |
|
237 |
+ j = (ssize_t)i; |
|
238 | 238 |
//figure out luhn digits |
239 | 239 |
for (j = digits - 1; j >= 0; j--) { |
240 | 240 |
val = cc_digits[j] - '0'; |
... | ... |
@@ -266,12 +265,9 @@ static int contains_cc(const unsigned char *buffer, size_t length, int detmode, |
266 | 266 |
end = buffer + length; |
267 | 267 |
idx = buffer; |
268 | 268 |
|
269 |
- while (idx < end) |
|
270 |
- { |
|
271 |
- if (isdigit(*idx)) |
|
272 |
- { |
|
273 |
- if ((idx == buffer || !isdigit(idx[-1])) && dlp_is_valid_cc(idx, length - (idx - buffer), cc_only) == 1) |
|
274 |
- { |
|
269 |
+ while (idx < end) { |
|
270 |
+ if (isdigit(*idx)) { |
|
271 |
+ if ((idx == buffer || !isdigit(idx[-1])) && dlp_is_valid_cc(idx, length - (idx - buffer), cc_only) == 1) { |
|
275 | 272 |
if (detmode == DETECT_MODE_DETECT) |
276 | 273 |
return 1; |
277 | 274 |
else { |
... | ... |
@@ -2638,7 +2638,7 @@ static int cli_scan_structured(cli_ctx *ctx) |
2638 | 2638 |
while (!done && ((result = fmap_readn(map, buf, pos, 8191)) > 0) && (result != (size_t)-1)) { |
2639 | 2639 |
pos += result; |
2640 | 2640 |
if ((cc_count += ccfunc((const unsigned char *)buf, result, |
2641 |
- (ctx->options->heuristic & CL_SCAN_HEURISTIC_STRUCTURED_CC)?1:0)) >= ctx->engine->min_cc_count) { |
|
2641 |
+ (ctx->options->heuristic & CL_SCAN_HEURISTIC_STRUCTURED_CC) ? 1 : 0)) >= ctx->engine->min_cc_count) { |
|
2642 | 2642 |
done = 1; |
2643 | 2643 |
} |
2644 | 2644 |
|