fixed minor warnings regarding type conversions.

pull/80/head
Micah Snyder 8 years ago
parent 264272918e
commit 7b1f1aaf9a
  1. 2
      libclamav/cvd.c
  2. 8
      libclamav/matcher-ac.c
  3. 6
      libclamav/mpool.c
  4. 2
      libclamav/mpool.h
  5. 4
      libclamav/others.h
  6. 10
      libclamav/readdb.c
  7. 4561
      libclamav/scanners.c

@ -213,7 +213,7 @@ static int cli_tgzload(int fd, struct cl_engine *engine, unsigned int *signo, un
unsigned int type, size, pad, compr = 1;
off_t off;
struct cli_dbinfo *db;
unsigned char hash[32];
char hash[32];
cli_dbgmsg("in cli_tgzload()\n");

@ -2341,13 +2341,13 @@ inline static int ac_special_altstr(const char *hexpr, uint8_t sigopts, struct c
for (i = 0; i < num; i++) {
if (num == 1) {
c = (char *) cli_mpool_hex2str(root->mempool, hexprcpy);
c = cli_mpool_hex2str(root->mempool, hexprcpy);
} else {
if(!(h = cli_strtok(hexprcpy, i, "|"))) {
free(hexprcpy);
return CL_EMEM;
}
c = (char *) cli_mpool_hex2str(root->mempool, h);
c = cli_mpool_hex2str(root->mempool, h);
free(h);
}
if (!c) {
@ -2356,10 +2356,10 @@ inline static int ac_special_altstr(const char *hexpr, uint8_t sigopts, struct c
}
if (special->type == AC_SPECIAL_ALT_CHAR) {
(special->alt).byte[i] = *c;
(special->alt).byte[i] = (unsigned char)*c;
mpool_free(root->mempool, c);
} else {
(special->alt).f_str[i] = c;
(special->alt).f_str[i] = (unsigned char*)c;
}
special->num++;
}

@ -756,8 +756,8 @@ void *mpool_realloc2(struct MP *mp, void *ptr, size_t size) {
return NULL;
}
unsigned char *cli_mpool_hex2str(mpool_t *mp, const char *hex) {
unsigned char *str;
char *cli_mpool_hex2str(mpool_t *mp, const char *hex) {
char *str;
size_t len = strlen((const char*)hex);
if (len&1) {
@ -770,7 +770,7 @@ unsigned char *cli_mpool_hex2str(mpool_t *mp, const char *hex) {
cli_errmsg("cli_mpool_hex2str(): Can't allocate memory (%lu bytes).\n", (unsigned long)(len/2 + 1));
return NULL;
}
if (cli_hex2str_to(hex, (char*)str, len) == -1) {
if (cli_hex2str_to(hex, str, len) == -1) {
mpool_free(mp, str);
return NULL;
}

@ -34,7 +34,7 @@ void mpool_free(mpool_t *mpool, void *ptr);
void *mpool_calloc(mpool_t *mpool, size_t nmemb, size_t size);
void *mpool_realloc(mpool_t *mpool, void *ptr, size_t size);
void *mpool_realloc2(mpool_t *mpool, void *ptr, size_t size);
unsigned char *cli_mpool_hex2str(mpool_t* mpool, const char *src);
char *cli_mpool_hex2str(mpool_t* mpool, const char *src);
char *cli_mpool_strdup(mpool_t *mpool, const char *s);
char *cli_mpool_strndup(mpool_t *mpool, const char *s, size_t n);
char *cli_mpool_virname(mpool_t *mpool, const char *virname, unsigned int official);

@ -234,7 +234,7 @@ struct icon_matcher {
struct cli_dbinfo {
char *name;
unsigned char *hash;
char *hash;
size_t size;
struct cl_cvd *cvd;
struct cli_dbinfo *next;
@ -249,7 +249,7 @@ typedef enum {
struct cli_pwdb {
char *name;
unsigned char *passwd;
char *passwd;
uint16_t length;
struct cli_pwdb *next;
};

@ -2193,8 +2193,8 @@ static int cli_loadinfo(FILE *fs, struct cl_engine *engine, unsigned int options
const char *tokens[INFO_TOKENS + 1];
char buffer[FILEBUFF];
unsigned int line = 0, tokens_count, len;
unsigned char hash[32];
struct cli_dbinfo *last = NULL, *new;
char hash[32];
struct cli_dbinfo *last = NULL, *new;
int ret = CL_SUCCESS, dsig = 0;
void *ctx;
@ -2213,7 +2213,7 @@ static int cli_loadinfo(FILE *fs, struct cl_engine *engine, unsigned int options
if(!(options & CL_DB_UNSIGNED) && !strncmp(buffer, "DSIG:", 5)) {
dsig = 1;
cl_finish_hash(ctx, hash);
if(cli_versig2(hash, buffer + 5, INFO_NSTR, INFO_ESTR) != CL_SUCCESS) {
if(cli_versig2((unsigned char*)hash, buffer + 5, INFO_NSTR, INFO_ESTR) != CL_SUCCESS) {
cli_errmsg("cli_loadinfo: Incorrect digital signature\n");
ret = CL_EMALFDB;
}
@ -2262,7 +2262,7 @@ static int cli_loadinfo(FILE *fs, struct cl_engine *engine, unsigned int options
ret = CL_EMALFDB;
break;
}
new = (struct cli_dbinfo *) mpool_calloc(engine->mempool, 1, sizeof(struct cli_dbinfo));
new = (struct cli_dbinfo *) mpool_calloc(engine->mempool, 1, sizeof(struct cli_dbinfo));
if(!new) {
ret = CL_EMEM;
break;
@ -2381,7 +2381,7 @@ static int cli_loadign(FILE *fs, struct cl_engine *engine, unsigned int options,
break;
}
if(hash) {
if(strlen(hash) != 32 || !(new->virname = (char *) cli_mpool_hex2str(engine->mempool, hash))) {
if(strlen(hash) != 32 || !(new->virname = cli_mpool_hex2str(engine->mempool, hash))) {
cli_errmsg("cli_loadign: Malformed MD5 string at line %u\n", line);
mpool_free(engine->mempool, new->pattern);
mpool_free(engine->mempool, new);

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save