... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* |
2 |
- * Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
2 |
+ * Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
3 | 3 |
* Copyright (C) 2007-2009 Sourcefire, Inc. |
4 | 4 |
* |
5 | 5 |
* Authors: Tomasz Kojm, Török Edvin |
... | ... |
@@ -54,6 +54,7 @@ |
54 | 54 |
#include "libclamav/others.h" |
55 | 55 |
#include "libclamav/scanners.h" |
56 | 56 |
|
57 |
+#include "shared/idmef_logging.h" |
|
57 | 58 |
#include "shared/optparser.h" |
58 | 59 |
#include "shared/output.h" |
59 | 60 |
#include "shared/misc.h" |
... | ... |
@@ -15677,7 +15677,7 @@ int crashtest() |
15677 | 15677 |
|
15678 | 15678 |
int main(void) |
15679 | 15679 |
{ |
15680 |
- int i; |
|
15680 |
+ size_t i; |
|
15681 | 15681 |
for(i=0;i<sizeof(values)/sizeof(values[0]);i++) { |
15682 | 15682 |
struct v* v= &values[i]; |
15683 | 15683 |
char* dst = v->dst; |
... | ... |
@@ -16394,7 +16394,7 @@ else |
16394 | 16394 |
int main(void) |
16395 | 16395 |
{ |
16396 | 16396 |
char *data, *data2, *data3; |
16397 |
- unsigned i, datasize = 1024; |
|
16397 |
+ size_t i, datasize = 1024; |
|
16398 | 16398 |
int fd; |
16399 | 16399 |
|
16400 | 16400 |
/* First, make a file with some known garbage in it. */ |
... | ... |
@@ -4,14 +4,14 @@ |
4 | 4 |
|
5 | 5 |
int main(int argc, char* argv[]) |
6 | 6 |
{ |
7 |
- int i; |
|
7 |
+ size_t i; |
|
8 | 8 |
uint8_t tbl[256]; |
9 | 9 |
if(argc < 3) { |
10 | 10 |
fprintf(stderr, "Usage: %s <variable-name> <character-range|single-char> ...\n", argv[0]); |
11 | 11 |
return 1; |
12 | 12 |
} |
13 | 13 |
memset(tbl, 0, sizeof(tbl)); |
14 |
- for(i=2;i<argc;i++) { |
|
14 |
+ for(i=2;i<(size_t)argc;i++) { |
|
15 | 15 |
const char* v = argv[i]; |
16 | 16 |
tbl[*v] = 1; |
17 | 17 |
if(v[1] == '-') { |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* |
2 |
- * Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
2 |
+ * Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
3 | 3 |
* Copyright (C) 2011 Sourcefire, Inc. |
4 | 4 |
* |
5 | 5 |
* Author: Török Edvin |
... | ... |
@@ -81,7 +81,7 @@ int main(void) |
81 | 81 |
{ |
82 | 82 |
struct arc4_state a; |
83 | 83 |
uint8_t data[32]; |
84 |
- unsigned i; |
|
84 |
+ size_t i; |
|
85 | 85 |
struct timeval tv0, tv1; |
86 | 86 |
|
87 | 87 |
for (i=0;i<sizeof(testdata)/sizeof(testdata[0]);i++) { |
... | ... |
@@ -91,7 +91,7 @@ int main(void) |
91 | 91 |
memcpy(data, testdata[i].plaintext, len); |
92 | 92 |
arc4_apply(&a, data, len); |
93 | 93 |
if (memcmp(data, testdata[i].result, len)) { |
94 |
- printf("Bad result at %d\n", i); |
|
94 |
+ printf("Bad result at %zu\n", i); |
|
95 | 95 |
} |
96 | 96 |
} |
97 | 97 |
gettimeofday(&tv0, NULL); |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
/* |
2 | 2 |
* Load, and verify ClamAV bytecode. |
3 | 3 |
* |
4 |
- * Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
4 |
+ * Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
5 | 5 |
* Copyright (C) 2009-2013 Sourcefire, Inc. |
6 | 6 |
* |
7 | 7 |
* Authors: Török Edvin |
... | ... |
@@ -1749,7 +1749,7 @@ static struct { |
1749 | 1749 |
|
1750 | 1750 |
static int register_events(cli_events_t *ev) |
1751 | 1751 |
{ |
1752 |
- unsigned i; |
|
1752 |
+ size_t i; |
|
1753 | 1753 |
for (i=0;i<sizeof(bc_events)/sizeof(bc_events[0]);i++) { |
1754 | 1754 |
if (cli_event_define(ev, bc_events[i].id, bc_events[i].name, bc_events[i].type, |
1755 | 1755 |
bc_events[i].multiple) == -1) |
... | ... |
@@ -634,7 +634,9 @@ static struct { |
634 | 634 |
|
635 | 635 |
int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct cli_bc_func *func, const struct cli_bc_inst *inst) |
636 | 636 |
{ |
637 |
- unsigned i, j, stack_depth=0, bb_inst=0, stop=0, pc=0; |
|
637 |
+ size_t i; |
|
638 |
+ uint32_t j; |
|
639 |
+ unsigned stack_depth=0, bb_inst=0, stop=0, pc=0; |
|
638 | 640 |
struct cli_bc_func *func2; |
639 | 641 |
struct stack stack; |
640 | 642 |
struct stack_entry *stack_entry = NULL; |
... | ... |
@@ -647,7 +649,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct |
647 | 647 |
|
648 | 648 |
memset(&ptrinfos, 0, sizeof(ptrinfos)); |
649 | 649 |
memset(&stack, 0, sizeof(stack)); |
650 |
- for (i=0;i < cli_apicall_maxglobal - _FIRST_GLOBAL; i++) { |
|
650 |
+ for (i=0; i < (size_t)cli_apicall_maxglobal - _FIRST_GLOBAL; i++) { |
|
651 | 651 |
void *apiptr; |
652 | 652 |
uint32_t size; |
653 | 653 |
const struct cli_apiglobal *g = &cli_globals[i]; |
... | ... |
@@ -820,7 +822,6 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct |
820 | 820 |
break; |
821 | 821 |
} |
822 | 822 |
case 1: { |
823 |
- unsigned i; |
|
824 | 823 |
void* arg1; |
825 | 824 |
unsigned arg2, arg1size; |
826 | 825 |
READ32(arg2, inst->u.ops.ops[1]); |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* |
2 |
- * Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
2 |
+ * Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
3 | 3 |
* Copyright (C) 2007-2014 Sourcefire, Inc. |
4 | 4 |
* |
5 | 5 |
* Authors: Nigel Horne, Török Edvin |
... | ... |
@@ -1345,8 +1345,8 @@ void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj) |
1345 | 1345 |
off_t dict_length, full_dict_length; |
1346 | 1346 |
off_t objsize = obj_size(pdf, obj, 1); |
1347 | 1347 |
off_t bytesleft; |
1348 |
- unsigned i, filters=0; |
|
1349 |
- unsigned blockopens=0; |
|
1348 |
+ size_t i; |
|
1349 |
+ unsigned filters=0, blockopens=0; |
|
1350 | 1350 |
enum objstate objstate = STATE_NONE; |
1351 | 1351 |
#if HAVE_JSON |
1352 | 1352 |
json_object *pdfobj=NULL, *jsonobj=NULL; |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* |
2 |
- * Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
2 |
+ * Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
3 | 3 |
* Copyright (C) 2007-2008 Sourcefire, Inc. |
4 | 4 |
* |
5 | 5 |
* Authors: Trog, Török Edvin |
... | ... |
@@ -355,7 +355,7 @@ static inline int swizz_j48(const uint16_t n[]) |
355 | 355 |
void cli_detect_swizz_str(const unsigned char *str, uint32_t len, struct swizz_stats *stats, int blob) |
356 | 356 |
{ |
357 | 357 |
unsigned char stri[4096]; |
358 |
- uint32_t i, j = 0; |
|
358 |
+ size_t i, j = 0; |
|
359 | 359 |
int bad = 0; |
360 | 360 |
int lastalnum = 0; |
361 | 361 |
uint8_t ngrams[17576]; |
... | ... |
@@ -365,7 +365,8 @@ void cli_detect_swizz_str(const unsigned char *str, uint32_t len, struct swizz_s |
365 | 365 |
int ret; |
366 | 366 |
|
367 | 367 |
stats->entries++; |
368 |
- for(i=0;i<len-1 && j < sizeof(stri)-2;i += 2) { |
|
368 |
+ for (i=0; (i < (size_t)len - 1) && (j < sizeof(stri) - 2); i += 2) |
|
369 |
+ { |
|
369 | 370 |
unsigned char c = str[i]; |
370 | 371 |
if (str[i+1] || !c) { |
371 | 372 |
bad++; |
... | ... |
@@ -452,7 +453,7 @@ int cli_detect_swizz(struct swizz_stats *stats) |
452 | 452 |
{ |
453 | 453 |
uint32_t gn[10]; |
454 | 454 |
uint32_t all = 0; |
455 |
- unsigned i; |
|
455 |
+ size_t i; |
|
456 | 456 |
int global_swizz = CL_CLEAN; |
457 | 457 |
|
458 | 458 |
cli_dbgmsg("cli_detect_swizz: %lu/%lu, version:%d, manifest: %d \n", |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
/* |
2 | 2 |
* Main YARA header file for ClamAV |
3 | 3 |
* |
4 |
- * Copyright (C) 2014 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
4 |
+ * Copyright (C) 2014, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
5 | 5 |
* |
6 | 6 |
* Authors: Steven Morgan |
7 | 7 |
* |
... | ... |
@@ -43,6 +43,7 @@ limitations under the License. |
43 | 43 |
#include "shared/queue.h" |
44 | 44 |
#include "yara_hash.h" |
45 | 45 |
#include "others.h" |
46 |
+#include "str.h" |
|
46 | 47 |
|
47 | 48 |
/* From libyara/include/yara/types.h */ |
48 | 49 |
#define DECLARE_REFERENCE(type, name) \ |
... | ... |
@@ -395,8 +395,9 @@ static int read_tables(int fd, unpack_data_t *unpack_data) |
395 | 395 |
uint8_t bit_length[BC]; |
396 | 396 |
unsigned char table[HUFF_TABLE_SIZE]; |
397 | 397 |
unsigned int bit_field; |
398 |
- int i, length, zero_count, number, n; |
|
399 |
- const int table_size=HUFF_TABLE_SIZE; |
|
398 |
+ int length, zero_count, number, n; |
|
399 |
+ size_t i; |
|
400 |
+ const size_t table_size=HUFF_TABLE_SIZE; |
|
400 | 401 |
|
401 | 402 |
rar_dbgmsg("in read_tables Offset=%ld in_addr=%d read_top=%d\n", lseek(fd, 0, SEEK_CUR), |
402 | 403 |
unpack_data->in_addr, unpack_data->read_top); |
... | ... |
@@ -270,7 +270,7 @@ unsigned int rarvm_read_data(rarvm_input_t *rarvm_input) |
270 | 270 |
static rarvm_standard_filters_t is_standard_filter(unsigned char *code, int code_size) |
271 | 271 |
{ |
272 | 272 |
uint32_t code_crc; |
273 |
- int i; |
|
273 |
+ size_t i; |
|
274 | 274 |
|
275 | 275 |
struct standard_filter_signature |
276 | 276 |
{ |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* |
2 |
- * Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
2 |
+ * Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
|
3 | 3 |
* Copyright (C) 2009 Sourcefire, Inc. |
4 | 4 |
* |
5 | 5 |
* Authors: aCaB <acab@clamav.net> |
... | ... |
@@ -23,7 +23,7 @@ |
23 | 23 |
#include "w32_errno.h" |
24 | 24 |
|
25 | 25 |
char *w32_strerror(int errnum) { |
26 |
- int i; |
|
26 |
+ size_t i; |
|
27 | 27 |
for(i=0; i<sizeof(w32_errnos) / sizeof(w32_errnos[0]); i++) { |
28 | 28 |
if(w32_errnos[i].err == errnum) |
29 | 29 |
return w32_errnos[i].strerr; |