eliminating warnings that cropped up in 32bit ubuntu (16.04)

remotes/push_mirror/bug11858-pull-requests
Micah Snyder 8 years ago
parent f59443aaaf
commit 7e64560ce5
  1. 4
      clamd/server-th.c
  2. 14
      libclamav/bytecode.c
  3. 4
      libclamav/png.c
  4. 4
      libclamav/spin.c
  5. 10
      libclamav/xar.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, Trog, Török Edvin
@ -437,7 +437,7 @@ static void *acceptloop_th(void *arg)
} else if (errno != EINTR) {
/* very bad - need to exit or restart */
#ifdef HAVE_STRERROR_R
strerror_r(errno, buff, BUFFSIZE);
(void)strerror_r(errno, buff, BUFFSIZE);
logg("!accept() failed: %s\n", buff);
#else
logg("!accept() failed\n");

@ -1393,11 +1393,11 @@ static int parseBB(struct cli_bc *bc, unsigned func, unsigned bb, unsigned char
offset++;
}
if (buffer[offset] == 'D') {
unsigned num;
uint32_t num;
offset += 3;
if (offset >= len)
return CL_EMALFDB;
num = readNumber(buffer, &offset, len, &ok);
num = (uint32_t)readNumber(buffer, &offset, len, &ok);
if (!ok)
return CL_EMALFDB;
if (num != bcfunc->numInsts) {
@ -1406,10 +1406,10 @@ static int parseBB(struct cli_bc *bc, unsigned func, unsigned bb, unsigned char
}
bcfunc->dbgnodes = cli_malloc(num*sizeof(*bcfunc->dbgnodes));
if (!bcfunc->dbgnodes) {
cli_errmsg("Unable to allocate memory for dbg nodes: %lu\n", num*sizeof(*bcfunc->dbgnodes));
cli_errmsg("Unable to allocate memory for dbg nodes: %u\n", num * (uint32_t)sizeof(*bcfunc->dbgnodes));
return CL_EMEM;
}
for (i=0;i<num;i++) {
for (i=0; (uint32_t)i < num; i++) {
bcfunc->dbgnodes[i] = readNumber(buffer, &offset, len, &ok);
if (!ok)
return CL_EMALFDB;
@ -2071,7 +2071,7 @@ static int cli_bytecode_prepare_interpreter(struct cli_bc *bc)
bc->numGlobalBytes = 0;
gmap = cli_malloc(bc->num_globals*sizeof(*gmap));
if (!gmap) {
cli_errmsg("interpreter: Unable to allocate memory for global map: %lu\n", bc->num_globals*sizeof(*gmap));
cli_errmsg("interpreter: Unable to allocate memory for global map: %zu\n", bc->num_globals*sizeof(*gmap));
return CL_EMEM;
}
for (j=0;j<bc->num_globals;j++) {
@ -2151,9 +2151,9 @@ static int cli_bytecode_prepare_interpreter(struct cli_bc *bc)
for (i=0;i<bc->num_func && ret == CL_SUCCESS;i++) {
struct cli_bc_func *bcfunc = &bc->funcs[i];
unsigned totValues = bcfunc->numValues + bcfunc->numConstants + bc->num_globals;
unsigned *map = cli_malloc(sizeof(*map)*totValues);
unsigned *map = cli_malloc(sizeof(*map) * (size_t)totValues);
if (!map) {
cli_errmsg("interpreter: Unable to allocate memory for map: %lu\n", sizeof(*map)*totValues);
cli_errmsg("interpreter: Unable to allocate memory for map: %zu\n", sizeof(*map) * (size_t)totValues);
free(gmap);
return CL_EMEM;
}

@ -5,7 +5,7 @@
* Greg Roelofs <newt@pobox.com>,
* John Bowler <jbowler@acm.org>,
* Tom Lane <tgl@sss.pgh.pa.us>
* 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.
* Maintainer: Tomasz Kojm <tkojm@clamav.net>
*
@ -710,7 +710,7 @@ int cli_parsepng(cli_ctx *ctx)
} else if (cur_y >= h) {
inflateEnd(&zstrm);
if(eod - p > 0) {
cli_dbgmsg("PNG: %ld bytes remaining in buffer before inflateEnd()", eod-p);
cli_dbgmsg("PNG: %u bytes remaining in buffer before inflateEnd()", (unsigned int)(eod - p));
return CL_EPARSE;
}
err = Z_STREAM_END;

@ -439,7 +439,7 @@ int unspin(char *src, int ssize, struct cli_exe_section *sections, int sectcnt,
cli_dbgmsg("spin: Compression bitmap is %x\n", bitmap);
if ((sects = (char **)cli_malloc(sectcnt * sizeof(char *))) == NULL)
{
cli_dbgmsg("spin: malloc(%lu) failed\n", sectcnt * sizeof(char *));
cli_dbgmsg("spin: malloc(%zu) failed\n", (size_t)sectcnt * sizeof(char *));
return 1;
}
@ -450,7 +450,7 @@ int unspin(char *src, int ssize, struct cli_exe_section *sections, int sectcnt,
{
if ((sects[j] = (char *)cli_malloc(sections[j].vsz)) == NULL)
{
cli_dbgmsg("spin: malloc(%d) failed\n", sections[j].vsz);
cli_dbgmsg("spin: malloc(%u) failed\n", sections[j].vsz);
len = 1;
break;
}

@ -81,7 +81,7 @@ static int xar_get_numeric_from_xml_element(xmlTextReaderPtr reader, size_t * va
if (numstr) {
numval = atol((const char *)numstr);
if (numval < 0) {
cli_dbgmsg("cli_scanxar: XML element value %li\n", *value);
cli_dbgmsg("cli_scanxar: XML element value %zu\n", *value);
return CL_EFORMAT;
}
*value = numval;
@ -678,7 +678,7 @@ int cli_scanxar(cli_ctx *ctx)
if (blockp == NULL) {
char errbuff[128];
cli_strerror(errno, errbuff, sizeof(errbuff));
cli_dbgmsg("cli_scanxar: Can't read %i bytes @ %li, errno:%s.\n",
cli_dbgmsg("cli_scanxar: Can't read %i bytes @ %zu, errno:%s.\n",
CLI_LZMA_HDR_SIZE, at, errbuff);
rc = CL_EREAD;
__lzma_wrap_free(NULL, buff);
@ -702,7 +702,7 @@ int cli_scanxar(cli_ctx *ctx)
at += CLI_LZMA_HDR_SIZE;
in_remaining -= CLI_LZMA_HDR_SIZE;
while ((size_t)at < map->len && (unsigned long)at < offset+hdr.toc_length_compressed+hdr.size+length) {
while (at < map->len && at < offset + (size_t)hdr.toc_length_compressed + (size_t)hdr.size + length) {
SizeT avail_in;
SizeT avail_out;
void * next_in;
@ -715,7 +715,7 @@ int cli_scanxar(cli_ctx *ctx)
if (lz.next_in == NULL) {
char errbuff[128];
cli_strerror(errno, errbuff, sizeof(errbuff));
cli_dbgmsg("cli_scanxar: Can't read %li bytes @ %li, errno: %s.\n",
cli_dbgmsg("cli_scanxar: Can't read %zu bytes @ %zu, errno: %s.\n",
lz.avail_in, at, errbuff);
rc = CL_EREAD;
__lzma_wrap_free(NULL, buff);
@ -799,7 +799,7 @@ int cli_scanxar(cli_ctx *ctx)
xar_hash_update(a_hash_ctx, blockp, writelen, a_hash);
if (cli_writen(fd, blockp, writelen) < 0) {
cli_dbgmsg("cli_scanxar: cli_writen error %zu bytes @ %li.\n", writelen, at);
cli_dbgmsg("cli_scanxar: cli_writen error %zu bytes @ %zu.\n", writelen, at);
rc = CL_EWRITE;
goto exit_tmpfile;
}

Loading…
Cancel
Save