| ... | ... |
@@ -566,7 +566,7 @@ cl_error_t cli_bcomp_compare_check(const unsigned char *f_buffer, size_t buffer_ |
| 566 | 566 |
uint16_t opt = 0; |
| 567 | 567 |
uint16_t opt_val = 0; |
| 568 | 568 |
int64_t value = 0; |
| 569 |
- uint64_t bin_value = 0; |
|
| 569 |
+ int64_t bin_value = 0; |
|
| 570 | 570 |
int16_t compare_check = 0; |
| 571 | 571 |
unsigned char *end_buf = NULL; |
| 572 | 572 |
unsigned char *buffer = NULL; |
| ... | ... |
@@ -716,16 +716,16 @@ cl_error_t cli_bcomp_compare_check(const unsigned char *f_buffer, size_t buffer_ |
| 716 | 716 |
/* exact byte_length option is implied for binary extraction */ |
| 717 | 717 |
switch (byte_len) {
|
| 718 | 718 |
case 1: |
| 719 |
- bin_value = (*(uint8_t *)f_buffer); |
|
| 719 |
+ bin_value = (int64_t)(*(uint8_t *)f_buffer); |
|
| 720 | 720 |
break; |
| 721 | 721 |
case 2: |
| 722 |
- bin_value = (uint16_t)le16_to_host(*(uint16_t *)f_buffer); |
|
| 722 |
+ bin_value = (int64_t)le16_to_host(*(uint16_t *)f_buffer); |
|
| 723 | 723 |
break; |
| 724 | 724 |
case 4: |
| 725 |
- bin_value = (uint32_t)le32_to_host(*(uint32_t *)f_buffer); |
|
| 725 |
+ bin_value = (int64_t)le32_to_host(*(uint32_t *)f_buffer); |
|
| 726 | 726 |
break; |
| 727 | 727 |
case 8: |
| 728 |
- bin_value = (uint64_t)le64_to_host(*(uint64_t *)f_buffer); |
|
| 728 |
+ bin_value = (int64_t)le64_to_host(*(uint64_t *)f_buffer); |
|
| 729 | 729 |
break; |
| 730 | 730 |
|
| 731 | 731 |
default: |
| ... | ... |
@@ -740,16 +740,16 @@ cl_error_t cli_bcomp_compare_check(const unsigned char *f_buffer, size_t buffer_ |
| 740 | 740 |
/* exact byte_length option is implied for binary extraction */ |
| 741 | 741 |
switch (byte_len) {
|
| 742 | 742 |
case 1: |
| 743 |
- bin_value = (*(uint8_t *)f_buffer); |
|
| 743 |
+ bin_value = (int64_t)(*(uint8_t *)f_buffer); |
|
| 744 | 744 |
break; |
| 745 | 745 |
case 2: |
| 746 |
- bin_value = (uint16_t)be16_to_host(*(uint16_t *)f_buffer); |
|
| 746 |
+ bin_value = (int64_t)be16_to_host(*(uint16_t *)f_buffer); |
|
| 747 | 747 |
break; |
| 748 | 748 |
case 4: |
| 749 |
- bin_value = (uint32_t)be32_to_host(*(uint32_t *)f_buffer); |
|
| 749 |
+ bin_value = (int64_t)be32_to_host(*(uint32_t *)f_buffer); |
|
| 750 | 750 |
break; |
| 751 | 751 |
case 8: |
| 752 |
- bin_value = (uint64_t)be64_to_host(*(uint64_t *)f_buffer); |
|
| 752 |
+ bin_value = (int64_t)be64_to_host(*(uint64_t *)f_buffer); |
|
| 753 | 753 |
break; |
| 754 | 754 |
|
| 755 | 755 |
default: |
| ... | ... |
@@ -4065,7 +4065,7 @@ do_multipart(message *mainMessage, message **messages, int i, mbox_status *rc, m |
| 4065 | 4065 |
fileblob *fb = messageToFileblob(aMessage, mctx->dir, 1); |
| 4066 | 4066 |
#if HAVE_JSON |
| 4067 | 4067 |
json_object *arrobj; |
| 4068 |
- int arrlen = 0; |
|
| 4068 |
+ size_t arrlen = 0; |
|
| 4069 | 4069 |
|
| 4070 | 4070 |
if (thisobj != NULL) {
|
| 4071 | 4071 |
/* attempt to determine container size - prevents incorrect type reporting */ |
| ... | ... |
@@ -4096,7 +4096,7 @@ do_multipart(message *mainMessage, message **messages, int i, mbox_status *rc, m |
| 4096 | 4096 |
if (entry) |
| 4097 | 4097 |
dtype = json_object_get_string(entry); |
| 4098 | 4098 |
} |
| 4099 |
- cli_jsonint(thisobj, "ContainedObjectsIndex", arrlen); |
|
| 4099 |
+ cli_jsonint(thisobj, "ContainedObjectsIndex", (uint32_t)arrlen); |
|
| 4100 | 4100 |
cli_jsonstr(thisobj, "ClamAVFileType", dtype ? dtype : "UNKNOWN"); |
| 4101 | 4101 |
} |
| 4102 | 4102 |
#endif |
| ... | ... |
@@ -95,6 +95,8 @@ static void msxml_error_handler(void *arg, const char *msg, xmlParserSeverities |
| 95 | 95 |
int line = xmlTextReaderLocatorLineNumber(locator); |
| 96 | 96 |
xmlChar *URI = xmlTextReaderLocatorBaseURI(locator); |
| 97 | 97 |
|
| 98 |
+ UNUSEDPARAM(arg); |
|
| 99 |
+ |
|
| 98 | 100 |
switch (severity) {
|
| 99 | 101 |
case XML_PARSER_SEVERITY_WARNING: |
| 100 | 102 |
case XML_PARSER_SEVERITY_VALIDITY_WARNING: |
| ... | ... |
@@ -76,8 +76,6 @@ |
| 76 | 76 |
|
| 77 | 77 |
struct pdf_struct; |
| 78 | 78 |
|
| 79 |
-static int asciihexdecode(const char *buf, off_t len, char *output); |
|
| 80 |
-static int ascii85decode(const char *buf, off_t len, unsigned char *output); |
|
| 81 | 79 |
static const char *pdf_nextlinestart(const char *ptr, size_t len); |
| 82 | 80 |
static const char *pdf_nextobject(const char *ptr, size_t len); |
| 83 | 81 |
|
| ... | ... |
@@ -3205,7 +3203,7 @@ cl_error_t pdf_find_and_extract_objs(struct pdf_struct *pdf, uint32_t *alerts) |
| 3205 | 3205 |
* a password to decrypt */ |
| 3206 | 3206 |
status = cli_append_virus(pdf->ctx, "Heuristics.Encrypted.PDF"); |
| 3207 | 3207 |
if (status == CL_VIRUS) {
|
| 3208 |
- *alerts++; |
|
| 3208 |
+ *alerts += 1; |
|
| 3209 | 3209 |
if (SCAN_ALLMATCHES) |
| 3210 | 3210 |
status = CL_CLEAN; |
| 3211 | 3211 |
} |
| ... | ... |
@@ -3215,7 +3213,7 @@ cl_error_t pdf_find_and_extract_objs(struct pdf_struct *pdf, uint32_t *alerts) |
| 3215 | 3215 |
status = run_pdf_hooks(pdf, PDF_PHASE_PARSED, -1, -1); |
| 3216 | 3216 |
cli_dbgmsg("pdf_find_and_extract_objs: (parsed hooks) returned %d\n", status);
|
| 3217 | 3217 |
if (status == CL_VIRUS) {
|
| 3218 |
- *alerts++; |
|
| 3218 |
+ *alerts += 1; |
|
| 3219 | 3219 |
if (SCAN_ALLMATCHES) {
|
| 3220 | 3220 |
status = CL_CLEAN; |
| 3221 | 3221 |
} |
| ... | ... |
@@ -3243,7 +3241,7 @@ cl_error_t pdf_find_and_extract_objs(struct pdf_struct *pdf, uint32_t *alerts) |
| 3243 | 3243 |
status = CL_CLEAN; |
| 3244 | 3244 |
break; |
| 3245 | 3245 |
case CL_VIRUS: |
| 3246 |
- *alerts++; |
|
| 3246 |
+ *alerts += 1; |
|
| 3247 | 3247 |
if (SCAN_ALLMATCHES) {
|
| 3248 | 3248 |
status = CL_CLEAN; |
| 3249 | 3249 |
} |
| ... | ... |
@@ -196,7 +196,7 @@ cli_regcomp_real(regex_t *preg, const char *pattern, int cflags) |
| 196 | 196 |
return(REG_ESPACE); |
| 197 | 197 |
} |
| 198 | 198 |
p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */ |
| 199 |
- assert(p->ssize >= len); |
|
| 199 |
+ assert((size_t)p->ssize >= len); |
|
| 200 | 200 |
|
| 201 | 201 |
p->strip = (sop *)cli_calloc(p->ssize, sizeof(sop)); |
| 202 | 202 |
p->slen = 0; |
| ... | ... |
@@ -2660,7 +2660,7 @@ static void get_thread_times(uint64_t *kt, uint64_t *ut) |
| 2660 | 2660 |
*ut = ul.QuadPart / 10; |
| 2661 | 2661 |
#else |
| 2662 | 2662 |
struct tms tbuf; |
| 2663 |
- if (times(&tbuf) != -1) {
|
|
| 2663 |
+ if (times(&tbuf) != ((clock_t)-1)) {
|
|
| 2664 | 2664 |
clock_t tck = sysconf(_SC_CLK_TCK); |
| 2665 | 2665 |
*kt = ((uint64_t)1000000) * tbuf.tms_stime / tck; |
| 2666 | 2666 |
*ut = ((uint64_t)1000000) * tbuf.tms_utime / tck; |
| ... | ... |
@@ -3958,7 +3958,6 @@ static cl_error_t cli_base_scandesc(int desc, const char *filepath, cli_ctx *ctx |
| 3958 | 3958 |
{
|
| 3959 | 3959 |
STATBUF sb; |
| 3960 | 3960 |
cl_error_t status = CL_CLEAN; |
| 3961 |
- cl_error_t ret = CL_CLEAN; |
|
| 3962 | 3961 |
|
| 3963 | 3962 |
if (!ctx) {
|
| 3964 | 3963 |
return CL_EARG; |
| ... | ... |
@@ -861,7 +861,7 @@ cl_error_t cli_strntoul_wrap(const char *buf, size_t buf_size, |
| 861 | 861 |
unsigned long *result) |
| 862 | 862 |
{
|
| 863 | 863 |
char *endptr = NULL; |
| 864 |
- long num; |
|
| 864 |
+ unsigned long num; |
|
| 865 | 865 |
|
| 866 | 866 |
if (buf_size == 0 || !buf || !result) {
|
| 867 | 867 |
/* invalid parameter */ |
| ... | ... |
@@ -869,7 +869,7 @@ cl_error_t cli_strntoul_wrap(const char *buf, size_t buf_size, |
| 869 | 869 |
} |
| 870 | 870 |
errno = 0; |
| 871 | 871 |
num = cli_strntoul(buf, buf_size, &endptr, base); |
| 872 |
- if (num == ULONG_MAX && errno == ERANGE) {
|
|
| 872 |
+ if ((num == ULONG_MAX) && (errno == ERANGE)) {
|
|
| 873 | 873 |
/* under- or overflow */ |
| 874 | 874 |
return CL_EPARSE; |
| 875 | 875 |
} |
| ... | ... |
@@ -887,7 +887,7 @@ cl_error_t cli_strntoul_wrap(const char *buf, size_t buf_size, |
| 887 | 887 |
} |
| 888 | 888 |
|
| 889 | 889 |
size_t cli_ldbtokenize(char *buffer, const char delim, const size_t token_count, |
| 890 |
- const char **tokens, int token_skip) |
|
| 890 |
+ const char **tokens, size_t token_skip) |
|
| 891 | 891 |
{
|
| 892 | 892 |
size_t tokens_found, i; |
| 893 | 893 |
int within_pcre = 0; |
| ... | ... |
@@ -32,7 +32,7 @@ |
| 32 | 32 |
#include "clamav.h" |
| 33 | 33 |
#include "clamav.h" |
| 34 | 34 |
|
| 35 |
-#define SIZE_T_CHARLEN ( (sizeof(size_t) * CHAR_BIT + 2) / 3 + 1 ) |
|
| 35 |
+#define SIZE_T_CHARLEN ((sizeof(size_t) * CHAR_BIT + 2) / 3 + 1) |
|
| 36 | 36 |
|
| 37 | 37 |
#ifdef HAVE_STRCASESTR |
| 38 | 38 |
#define cli_strcasestr strcasestr |
| ... | ... |
@@ -67,7 +67,7 @@ int cli_chomp(char *string); |
| 67 | 67 |
char *cli_strtok(const char *line, int field, const char *delim); |
| 68 | 68 |
int cli_realhex2ui(const char *hex, uint16_t *ptr, unsigned int len); |
| 69 | 69 |
uint16_t *cli_hex2ui(const char *hex); |
| 70 |
-int cli_hex2str_to(const char *hex, char *ptr, size_t len); |
|
| 70 |
+int cli_hex2str_to(const char *hex, char *ptr, size_t len); |
|
| 71 | 71 |
char *cli_hex2str(const char *hex); |
| 72 | 72 |
int cli_hex2num(const char *hex); |
| 73 | 73 |
int cli_xtoi(const char *hex); |
| ... | ... |
@@ -77,15 +77,15 @@ char *cli_strtokbuf(const char *input, int fieldno, const char *delim, char *out |
| 77 | 77 |
const char *cli_memstr(const char *haystack, size_t hs, const char *needle, size_t ns); |
| 78 | 78 |
char *cli_strrcpy(char *dest, const char *source); |
| 79 | 79 |
size_t cli_strtokenize(char *buffer, const char delim, const size_t token_count, const char **tokens); |
| 80 |
-size_t cli_ldbtokenize(char *buffer, const char delim, const size_t token_count, const char **tokens, int token_skip); |
|
| 81 |
-long cli_strntol(const char* nptr, size_t n, char** endptr, register int base); |
|
| 82 |
-unsigned long cli_strntoul(const char* nptr, size_t n, char** endptr, register int base); |
|
| 80 |
+size_t cli_ldbtokenize(char *buffer, const char delim, const size_t token_count, const char **tokens, size_t token_skip); |
|
| 81 |
+long cli_strntol(const char *nptr, size_t n, char **endptr, register int base); |
|
| 82 |
+unsigned long cli_strntoul(const char *nptr, size_t n, char **endptr, register int base); |
|
| 83 | 83 |
cl_error_t cli_strntol_wrap(const char *buf, size_t buf_size, int fail_at_nondigit, int base, long *result); |
| 84 | 84 |
cl_error_t cli_strntoul_wrap(const char *buf, size_t buf_size, int fail_at_nondigit, int base, unsigned long *result); |
| 85 | 85 |
int cli_isnumber(const char *str); |
| 86 | 86 |
char *cli_unescape(const char *str); |
| 87 | 87 |
struct text_buffer; |
| 88 |
-int cli_textbuffer_append_normalize(struct text_buffer *buf, const char *str, size_t len); |
|
| 88 |
+int cli_textbuffer_append_normalize(struct text_buffer *buf, const char *str, size_t len); |
|
| 89 | 89 |
int cli_hexnibbles(char *str, int len); |
| 90 | 90 |
|
| 91 | 91 |
typedef enum {
|