Eliminating warnings, converting iterator variables to size_t when used to compare against sizeof(). added a couple of missing #includes.

remotes/push_mirror/bug11858-pull-requests
Micah Snyder 9 years ago
parent a6af751079
commit d18d72219f
  1. 3
      clamd/scanner.c
  2. 4
      configure
  3. 4
      contrib/entitynorm/gentbl.c
  4. 6
      libclamav/arc4.c
  5. 4
      libclamav/bytecode.c
  6. 7
      libclamav/bytecode_vm.c
  7. 6
      libclamav/pdf.c
  8. 9
      libclamav/special.c
  9. 3
      libclamav/yara_clam.h
  10. 5
      libclamunrar/unrar.c
  11. 2
      libclamunrar/unrarvm.c
  12. 2
      m4/mmap_private.m4
  13. 2
      m4/reorganization/compiler_checks.m4
  14. 4
      win32/compat/w32_errno.c

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2007-2009 Sourcefire, Inc.
*
* Authors: Tomasz Kojm, Török Edvin
@ -54,6 +54,7 @@
#include "libclamav/others.h"
#include "libclamav/scanners.h"
#include "shared/idmef_logging.h"
#include "shared/optparser.h"
#include "shared/output.h"
#include "shared/misc.h"

4
configure vendored

@ -15677,7 +15677,7 @@ int crashtest()
int main(void)
{
int i;
size_t i;
for(i=0;i<sizeof(values)/sizeof(values[0]);i++) {
struct v* v= &values[i];
char* dst = v->dst;
@ -16394,7 +16394,7 @@ else
int main(void)
{
char *data, *data2, *data3;
unsigned i, datasize = 1024;
size_t i, datasize = 1024;
int fd;
/* First, make a file with some known garbage in it. */

@ -4,14 +4,14 @@
int main(int argc, char* argv[])
{
int i;
size_t i;
uint8_t tbl[256];
if(argc < 3) {
fprintf(stderr, "Usage: %s <variable-name> <character-range|single-char> ...\n", argv[0]);
return 1;
}
memset(tbl, 0, sizeof(tbl));
for(i=2;i<argc;i++) {
for(i=2;i<(size_t)argc;i++) {
const char* v = argv[i];
tbl[*v] = 1;
if(v[1] == '-') {

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2011 Sourcefire, Inc.
*
* Author: Török Edvin
@ -81,7 +81,7 @@ int main(void)
{
struct arc4_state a;
uint8_t data[32];
unsigned i;
size_t i;
struct timeval tv0, tv1;
for (i=0;i<sizeof(testdata)/sizeof(testdata[0]);i++) {
@ -91,7 +91,7 @@ int main(void)
memcpy(data, testdata[i].plaintext, len);
arc4_apply(&a, data, len);
if (memcmp(data, testdata[i].result, len)) {
printf("Bad result at %d\n", i);
printf("Bad result at %zu\n", i);
}
}
gettimeofday(&tv0, NULL);

@ -1,7 +1,7 @@
/*
* Load, and verify ClamAV bytecode.
*
* Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2009-2013 Sourcefire, Inc.
*
* Authors: Török Edvin
@ -1749,7 +1749,7 @@ static struct {
static int register_events(cli_events_t *ev)
{
unsigned i;
size_t i;
for (i=0;i<sizeof(bc_events)/sizeof(bc_events[0]);i++) {
if (cli_event_define(ev, bc_events[i].id, bc_events[i].name, bc_events[i].type,
bc_events[i].multiple) == -1)

@ -634,7 +634,9 @@ static struct {
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)
{
unsigned i, j, stack_depth=0, bb_inst=0, stop=0, pc=0;
size_t i;
uint32_t j;
unsigned stack_depth=0, bb_inst=0, stop=0, pc=0;
struct cli_bc_func *func2;
struct stack stack;
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
memset(&ptrinfos, 0, sizeof(ptrinfos));
memset(&stack, 0, sizeof(stack));
for (i=0;i < cli_apicall_maxglobal - _FIRST_GLOBAL; i++) {
for (i=0; i < (size_t)cli_apicall_maxglobal - _FIRST_GLOBAL; i++) {
void *apiptr;
uint32_t size;
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
break;
}
case 1: {
unsigned i;
void* arg1;
unsigned arg2, arg1size;
READ32(arg2, inst->u.ops.ops[1]);

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2007-2014 Sourcefire, Inc.
*
* Authors: Nigel Horne, Török Edvin
@ -1345,8 +1345,8 @@ void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj)
off_t dict_length, full_dict_length;
off_t objsize = obj_size(pdf, obj, 1);
off_t bytesleft;
unsigned i, filters=0;
unsigned blockopens=0;
size_t i;
unsigned filters=0, blockopens=0;
enum objstate objstate = STATE_NONE;
#if HAVE_JSON
json_object *pdfobj=NULL, *jsonobj=NULL;

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2007-2008 Sourcefire, Inc.
*
* Authors: Trog, Török Edvin
@ -355,7 +355,7 @@ static inline int swizz_j48(const uint16_t n[])
void cli_detect_swizz_str(const unsigned char *str, uint32_t len, struct swizz_stats *stats, int blob)
{
unsigned char stri[4096];
uint32_t i, j = 0;
size_t i, j = 0;
int bad = 0;
int lastalnum = 0;
uint8_t ngrams[17576];
@ -365,7 +365,8 @@ void cli_detect_swizz_str(const unsigned char *str, uint32_t len, struct swizz_s
int ret;
stats->entries++;
for(i=0;i<len-1 && j < sizeof(stri)-2;i += 2) {
for (i=0; (i < (size_t)len - 1) && (j < sizeof(stri) - 2); i += 2)
{
unsigned char c = str[i];
if (str[i+1] || !c) {
bad++;
@ -452,7 +453,7 @@ int cli_detect_swizz(struct swizz_stats *stats)
{
uint32_t gn[10];
uint32_t all = 0;
unsigned i;
size_t i;
int global_swizz = CL_CLEAN;
cli_dbgmsg("cli_detect_swizz: %lu/%lu, version:%d, manifest: %d \n",

@ -1,7 +1,7 @@
/*
* Main YARA header file for ClamAV
*
* Copyright (C) 2014 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2014, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
*
* Authors: Steven Morgan
*
@ -43,6 +43,7 @@ limitations under the License.
#include "shared/queue.h"
#include "yara_hash.h"
#include "others.h"
#include "str.h"
/* From libyara/include/yara/types.h */
#define DECLARE_REFERENCE(type, name) \

@ -395,8 +395,9 @@ static int read_tables(int fd, unpack_data_t *unpack_data)
uint8_t bit_length[BC];
unsigned char table[HUFF_TABLE_SIZE];
unsigned int bit_field;
int i, length, zero_count, number, n;
const int table_size=HUFF_TABLE_SIZE;
int length, zero_count, number, n;
size_t i;
const size_t table_size=HUFF_TABLE_SIZE;
rar_dbgmsg("in read_tables Offset=%ld in_addr=%d read_top=%d\n", lseek(fd, 0, SEEK_CUR),
unpack_data->in_addr, unpack_data->read_top);

@ -270,7 +270,7 @@ unsigned int rarvm_read_data(rarvm_input_t *rarvm_input)
static rarvm_standard_filters_t is_standard_filter(unsigned char *code, int code_size)
{
uint32_t code_crc;
int i;
size_t i;
struct standard_filter_signature
{

@ -20,7 +20,7 @@ AC_DEFUN([AC_C_FUNC_MMAP_PRIVATE],
int main(void)
{
char *data, *data2, *data3;
unsigned i, datasize = 1024;
size_t i, datasize = 1024;
int fd;
/* First, make a file with some known garbage in it. */

@ -141,7 +141,7 @@ int crashtest()
int main(void)
{
int i;
size_t i;
for(i=0;i<sizeof(values)/sizeof(values[0]);i++) {
struct v* v= &values[i];
char* dst = v->dst;

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2009 Sourcefire, Inc.
*
* Authors: aCaB <acab@clamav.net>
@ -23,7 +23,7 @@
#include "w32_errno.h"
char *w32_strerror(int errnum) {
int i;
size_t i;
for(i=0; i<sizeof(w32_errnos) / sizeof(w32_errnos[0]); i++) {
if(w32_errnos[i].err == errnum)
return w32_errnos[i].strerr;

Loading…
Cancel
Save