... | ... |
@@ -22,10 +22,11 @@ int g_allocCount = 0; |
22 | 22 |
int g_allocCountTemp = 0; |
23 | 23 |
|
24 | 24 |
#endif |
25 |
+#include "clamav.h" |
|
25 | 26 |
|
26 | 27 |
void *SzAlloc(void *p, size_t size) |
27 | 28 |
{ |
28 |
- p = p; |
|
29 |
+ UNUSEDPARAM(p); |
|
29 | 30 |
if (size == 0) |
30 | 31 |
return 0; |
31 | 32 |
#ifdef _SZ_ALLOC_DEBUG |
... | ... |
@@ -37,7 +38,7 @@ void *SzAlloc(void *p, size_t size) |
37 | 37 |
|
38 | 38 |
void SzFree(void *p, void *address) |
39 | 39 |
{ |
40 |
- p = p; |
|
40 |
+ UNUSEDPARAM(p); |
|
41 | 41 |
#ifdef _SZ_ALLOC_DEBUG |
42 | 42 |
if (address != 0) |
43 | 43 |
{ |
... | ... |
@@ -50,7 +51,7 @@ void SzFree(void *p, void *address) |
50 | 50 |
|
51 | 51 |
void *SzAllocTemp(void *p, size_t size) |
52 | 52 |
{ |
53 |
- p = p; |
|
53 |
+ UNUSEDPARAM(p); |
|
54 | 54 |
if (size == 0) |
55 | 55 |
return 0; |
56 | 56 |
#ifdef _SZ_ALLOC_DEBUG |
... | ... |
@@ -65,7 +66,7 @@ void *SzAllocTemp(void *p, size_t size) |
65 | 65 |
|
66 | 66 |
void SzFreeTemp(void *p, void *address) |
67 | 67 |
{ |
68 |
- p = p; |
|
68 |
+ UNUSEDPARAM(p); |
|
69 | 69 |
#ifdef _SZ_ALLOC_DEBUG |
70 | 70 |
if (address != 0) |
71 | 71 |
{ |
... | ... |
@@ -19,6 +19,9 @@ Byte k7zSignature[k7zSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C}; |
19 | 19 |
#define NUM_FOLDER_CODERS_MAX 32 |
20 | 20 |
#define NUM_CODER_STREAMS_MAX 32 |
21 | 21 |
|
22 |
+void SzFolder_Free(CSzFolder *p, ISzAlloc *alloc); |
|
23 |
+int SzFolder_FindBindPairForOutStream(CSzFolder *p, UInt32 outStreamIndex); |
|
24 |
+ |
|
22 | 25 |
void SzCoderInfo_Init(CSzCoderInfo *p) |
23 | 26 |
{ |
24 | 27 |
Buf_Init(&p->Props); |
... | ... |
@@ -115,6 +115,8 @@ StopCompilingDueBUG |
115 | 115 |
|
116 | 116 |
#define LZMA_DIC_MIN (1 << 12) |
117 | 117 |
|
118 |
+void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState); |
|
119 |
+ |
|
118 | 120 |
/* First LZMA-symbol is always decoded. |
119 | 121 |
And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization |
120 | 122 |
Out: |
... | ... |
@@ -68,7 +68,7 @@ void XzCheck_Update(CXzCheck *p, const void *data, size_t size) |
68 | 68 |
case XZ_CHECK_CRC64: p->crc64 = Crc64Update(p->crc64, data, size); break; |
69 | 69 |
case XZ_CHECK_SHA256: |
70 | 70 |
if ((p->sha)) |
71 |
- cl_update_hash(p->sha, (const Byte *)data, size); |
|
71 |
+ cl_update_hash(p->sha, (void *)data, size); |
|
72 | 72 |
break; |
73 | 73 |
} |
74 | 74 |
} |
... | ... |
@@ -33,6 +33,11 @@ |
33 | 33 |
|
34 | 34 |
#define CODER_BUF_SIZE (1 << 17) |
35 | 35 |
|
36 |
+void BraState_Free(void *pp, ISzAlloc *alloc); |
|
37 |
+SRes BraState_SetProps(void *pp, const Byte *props, size_t propSize, ISzAlloc *alloc); |
|
38 |
+void BraState_Init(void *pp); |
|
39 |
+SRes BraState_SetFromMethod(IStateCoder *p, UInt64 id, ISzAlloc *alloc); |
|
40 |
+ |
|
36 | 41 |
unsigned Xz_ReadVarInt(const Byte *p, size_t maxSize, UInt64 *value) |
37 | 42 |
{ |
38 | 43 |
int i, limit; |
... | ... |
@@ -77,7 +82,7 @@ void BraState_Free(void *pp, ISzAlloc *alloc) |
77 | 77 |
SRes BraState_SetProps(void *pp, const Byte *props, size_t propSize, ISzAlloc *alloc) |
78 | 78 |
{ |
79 | 79 |
CBraState *p = ((CBraState *)pp); |
80 |
- alloc = alloc; |
|
80 |
+ UNUSEDPARAM(alloc); |
|
81 | 81 |
p->encodeMode = 0; |
82 | 82 |
p->ip = 0; |
83 | 83 |
if (p->methodId == XZ_ID_Delta) |
... | ... |
@@ -133,9 +138,9 @@ static SRes BraState_Code(void *pp, Byte *dest, SizeT *destLen, const Byte *src, |
133 | 133 |
CBraState *p = ((CBraState *)pp); |
134 | 134 |
SizeT destLenOrig = *destLen; |
135 | 135 |
SizeT srcLenOrig = *srcLen; |
136 |
+ UNUSEDPARAM(finishMode); |
|
136 | 137 |
*destLen = 0; |
137 | 138 |
*srcLen = 0; |
138 |
- finishMode = finishMode; |
|
139 | 139 |
*wasFinished = 0; |
140 | 140 |
while (destLenOrig > 0) |
141 | 141 |
{ |
... | ... |
@@ -300,9 +305,9 @@ static SRes Lzma2State_Code(void *pp, Byte *dest, SizeT *destLen, const Byte *sr |
300 | 300 |
int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished) |
301 | 301 |
{ |
302 | 302 |
ELzmaStatus status; |
303 |
+ UNUSEDPARAM(srcWasFinished); |
|
303 | 304 |
/* ELzmaFinishMode fm = (finishMode == LZMA_FINISH_ANY) ? LZMA_FINISH_ANY : LZMA_FINISH_END; */ |
304 | 305 |
SRes res = Lzma2Dec_DecodeToBuf((CLzma2Dec *)pp, dest, destLen, src, srcLen, finishMode, &status); |
305 |
- srcWasFinished = srcWasFinished; |
|
306 | 306 |
*wasFinished = (status == LZMA_STATUS_FINISHED_WITH_MARK); |
307 | 307 |
return res; |
308 | 308 |
} |
... | ... |
@@ -785,7 +790,7 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen, |
785 | 785 |
srcRem = (SizeT)cur; |
786 | 786 |
p->crc = CrcUpdate(p->crc, src, srcRem); |
787 | 787 |
if ((p->sha)) |
788 |
- cl_update_hash(p->sha, src, srcRem); |
|
788 |
+ cl_update_hash(p->sha, (void *)src, srcRem); |
|
789 | 789 |
(*srcLen) += srcRem; |
790 | 790 |
src += srcRem; |
791 | 791 |
p->indexPos += srcRem; |
... | ... |
@@ -146,7 +146,7 @@ int cli_7unz (cli_ctx *ctx, size_t offset) { |
146 | 146 |
} |
147 | 147 |
|
148 | 148 |
name = (char *)utf16name; |
149 |
- for(j=0; j<newnamelen; j++) /* FIXME */ |
|
149 |
+ for(j=0; j<(size_t)newnamelen; j++) /* FIXME */ |
|
150 | 150 |
name[j] = utf16name[j]; |
151 | 151 |
name[j] = 0; |
152 | 152 |
cli_dbgmsg("cli_7unz: extracting %s\n", name); |
... | ... |
@@ -177,7 +177,7 @@ int cli_7unz (cli_ctx *ctx, size_t offset) { |
177 | 177 |
break; |
178 | 178 |
|
179 | 179 |
cli_dbgmsg("cli_7unz: Saving to %s\n", name); |
180 |
- if(cli_writen(fd, outBuffer + offset, outSizeProcessed) != outSizeProcessed) |
|
180 |
+ if((size_t)cli_writen(fd, outBuffer + offset, outSizeProcessed) != outSizeProcessed) |
|
181 | 181 |
found = CL_EWRITE; |
182 | 182 |
else |
183 | 183 |
if ((found = cli_magic_scandesc(fd, ctx)) == CL_VIRUS) |
... | ... |
@@ -52,7 +52,7 @@ int cli_scanapm(cli_ctx *ctx) |
52 | 52 |
struct apm_driver_desc_map ddm; |
53 | 53 |
struct apm_partition_info aptable, apentry; |
54 | 54 |
int ret = CL_CLEAN, detection = CL_CLEAN, old_school = 0; |
55 |
- size_t sectorsize, maplen, partsize, sectorcheck; |
|
55 |
+ size_t sectorsize, maplen, partsize; |
|
56 | 56 |
off_t pos = 0, partoff = 0; |
57 | 57 |
unsigned i; |
58 | 58 |
uint32_t max_prtns = 0; |
... | ... |
@@ -1044,7 +1044,7 @@ static int asn1_parse_mscat(fmap_t *map, size_t offset, unsigned int size, crtmg |
1044 | 1044 |
break; |
1045 | 1045 |
|
1046 | 1046 |
cl_update_hash(ctx, "\x31", 1); |
1047 |
- cl_update_hash(ctx, attrs + 1, attrs_size - 1); |
|
1047 |
+ cl_update_hash(ctx, (void *)(attrs + 1), attrs_size - 1); |
|
1048 | 1048 |
cl_finish_hash(ctx, sha1); |
1049 | 1049 |
|
1050 | 1050 |
if(!fmap_need_ptr_once(map, asn1.content, asn1.size)) { |
... | ... |
@@ -1288,7 +1288,7 @@ static int asn1_parse_mscat(fmap_t *map, size_t offset, unsigned int size, crtmg |
1288 | 1288 |
break; |
1289 | 1289 |
|
1290 | 1290 |
cl_update_hash(ctx, "\x31", 1); |
1291 |
- cl_update_hash(ctx, attrs + 1, attrs_size - 1); |
|
1291 |
+ cl_update_hash(ctx, (void *)(attrs + 1), attrs_size - 1); |
|
1292 | 1292 |
cl_finish_hash(ctx, sha1); |
1293 | 1293 |
} else { |
1294 | 1294 |
ctx = cl_hash_init("md5"); |
... | ... |
@@ -1296,7 +1296,7 @@ static int asn1_parse_mscat(fmap_t *map, size_t offset, unsigned int size, crtmg |
1296 | 1296 |
break; |
1297 | 1297 |
|
1298 | 1298 |
cl_update_hash(ctx, "\x31", 1); |
1299 |
- cl_update_hash(ctx, attrs + 1, attrs_size - 1); |
|
1299 |
+ cl_update_hash(ctx, (void *)(attrs + 1), attrs_size - 1); |
|
1300 | 1300 |
cl_finish_hash(ctx, sha1); |
1301 | 1301 |
} |
1302 | 1302 |
|
... | ... |
@@ -18,8 +18,6 @@ |
18 | 18 |
* MA 02110-1301, USA. |
19 | 19 |
*/ |
20 | 20 |
|
21 |
-static char const rcsid[] = "$Id: blob.c,v 1.64 2007/02/12 22:25:14 njh Exp $"; |
|
22 |
- |
|
23 | 21 |
#if HAVE_CONFIG_H |
24 | 22 |
#include "clamav-config.h" |
25 | 23 |
#endif |
... | ... |
@@ -144,6 +142,8 @@ blobSetFilename(blob *b, const char *dir, const char *filename) |
144 | 144 |
assert(b->magic == BLOBCLASS); |
145 | 145 |
assert(filename != NULL); |
146 | 146 |
|
147 |
+ UNUSEDPARAM(dir); |
|
148 |
+ |
|
147 | 149 |
cli_dbgmsg("blobSetFilename: %s\n", filename); |
148 | 150 |
|
149 | 151 |
if(b->name) |
... | ... |
@@ -474,6 +474,8 @@ fileblobDestroy(fileblob *fb) |
474 | 474 |
void |
475 | 475 |
fileblobPartialSet(fileblob *fb, const char *fullname, const char *arg) |
476 | 476 |
{ |
477 |
+ UNUSEDPARAM(arg); |
|
478 |
+ |
|
477 | 479 |
if(fb->b.name) |
478 | 480 |
return; |
479 | 481 |
|
... | ... |
@@ -363,6 +363,10 @@ int cli_bytecode_context_setparam_int(struct cli_bc_ctx *ctx, unsigned i, uint64 |
363 | 363 |
|
364 | 364 |
int cli_bytecode_context_setparam_ptr(struct cli_bc_ctx *ctx, unsigned i, void *data, unsigned datalen) |
365 | 365 |
{ |
366 |
+ UNUSEDPARAM(ctx); |
|
367 |
+ UNUSEDPARAM(i); |
|
368 |
+ UNUSEDPARAM(data); |
|
369 |
+ UNUSEDPARAM(datalen); |
|
366 | 370 |
cli_errmsg("Pointer parameters are not implemented yet!\n"); |
367 | 371 |
return CL_EARG; |
368 | 372 |
} |
... | ... |
@@ -2270,7 +2274,7 @@ static int cli_bytecode_prepare_interpreter(struct cli_bc *bc) |
2270 | 2270 |
MAP(inst->u.three[1]); |
2271 | 2271 |
MAP(inst->u.three[2]); |
2272 | 2272 |
inst->u.three[0] = get_geptypesize(bc, inst->u.three[0]); |
2273 |
- if (inst->u.three[0] == -1) |
|
2273 |
+ if ((int)(inst->u.three[0]) == -1) |
|
2274 | 2274 |
ret = CL_EBYTECODE; |
2275 | 2275 |
break; |
2276 | 2276 |
case OP_BC_GEPZ: |
... | ... |
@@ -2644,7 +2648,7 @@ int cli_bytecode_prepare2(struct cl_engine *engine, struct cli_all_bc *bcs, unsi |
2644 | 2644 |
rc = cli_bytecode_context_getresult_int(ctx); |
2645 | 2645 |
/* check magic number, don't use 0 here because it is too easy for a |
2646 | 2646 |
* buggy bytecode to return 0 */ |
2647 |
- if (rc != 0xda7aba5e) { |
|
2647 |
+ if ((unsigned int)rc != (unsigned int)0xda7aba5e) { |
|
2648 | 2648 |
cli_warnmsg("Bytecode: selftest failed with code %08x. Please report to http://bugs.clamav.net\n", |
2649 | 2649 |
rc); |
2650 | 2650 |
if (engine->bytecode_mode == CL_BYTECODE_MODE_TEST) |
... | ... |
@@ -3012,7 +3016,7 @@ void cli_bytecode_describe(const struct cli_bc *bc) |
3012 | 3012 |
unsigned len = strlen(cli_apicalls[i].name); |
3013 | 3013 |
if (had) |
3014 | 3014 |
printf(","); |
3015 |
- if (len > cols) { |
|
3015 |
+ if (len > (unsigned int)cols) { |
|
3016 | 3016 |
printf("\n\t"); |
3017 | 3017 |
cols = 72; |
3018 | 3018 |
} |
... | ... |
@@ -63,11 +63,13 @@ |
63 | 63 |
|
64 | 64 |
uint32_t cli_bcapi_test1(struct cli_bc_ctx *ctx, uint32_t a, uint32_t b) |
65 | 65 |
{ |
66 |
+ UNUSEDPARAM(ctx); |
|
66 | 67 |
return (a==0xf00dbeef && b==0xbeeff00d) ? 0x12345678 : 0x55; |
67 | 68 |
} |
68 | 69 |
|
69 | 70 |
uint32_t cli_bcapi_test2(struct cli_bc_ctx *ctx, uint32_t a) |
70 | 71 |
{ |
72 |
+ UNUSEDPARAM(ctx); |
|
71 | 73 |
return a == 0xf00d ? 0xd00f : 0x5555; |
72 | 74 |
} |
73 | 75 |
|
... | ... |
@@ -131,6 +133,7 @@ int32_t cli_bcapi_seek(struct cli_bc_ctx* ctx, int32_t pos, uint32_t whence) |
131 | 131 |
|
132 | 132 |
uint32_t cli_bcapi_debug_print_str(struct cli_bc_ctx *ctx, const uint8_t *str, uint32_t len) |
133 | 133 |
{ |
134 |
+ UNUSEDPARAM(len); |
|
134 | 135 |
cli_event_fastdata(EV, BCEV_DBG_STR, str, strlen((const char*)str)); |
135 | 136 |
cli_dbgmsg("bytecode debug: %s\n", str); |
136 | 137 |
return 0; |
... | ... |
@@ -151,6 +154,7 @@ uint32_t cli_bcapi_debug_print_uint(struct cli_bc_ctx *ctx, uint32_t a) |
151 | 151 |
* executing */ |
152 | 152 |
uint32_t cli_bcapi_setvirusname(struct cli_bc_ctx* ctx, const uint8_t *name, uint32_t len) |
153 | 153 |
{ |
154 |
+ UNUSEDPARAM(len); |
|
154 | 155 |
ctx->virname = (const char*)name; |
155 | 156 |
return 0; |
156 | 157 |
} |
... | ... |
@@ -160,7 +164,8 @@ uint32_t cli_bcapi_disasm_x86(struct cli_bc_ctx *ctx, struct DISASM_RESULT *res, |
160 | 160 |
int n; |
161 | 161 |
const unsigned char *buf; |
162 | 162 |
const unsigned char* next; |
163 |
- if (!res || !ctx->fmap || ctx->off >= ctx->fmap->len) { |
|
163 |
+ UNUSEDPARAM(len); |
|
164 |
+ if (!res || !ctx->fmap || (size_t)(ctx->off) >= ctx->fmap->len) { |
|
164 | 165 |
API_MISUSE(); |
165 | 166 |
return -1; |
166 | 167 |
} |
... | ... |
@@ -255,6 +260,7 @@ uint32_t cli_bcapi_trace_scope(struct cli_bc_ctx *ctx, const uint8_t *scope, uin |
255 | 255 |
|
256 | 256 |
uint32_t cli_bcapi_trace_directory(struct cli_bc_ctx *ctx, const uint8_t* dir, uint32_t dummy) |
257 | 257 |
{ |
258 |
+ UNUSEDPARAM(dummy); |
|
258 | 259 |
if (LIKELY(!ctx->trace_level)) |
259 | 260 |
return 0; |
260 | 261 |
ctx->directory = (const char*)dir ? (const char*)dir : ""; |
... | ... |
@@ -314,6 +320,7 @@ uint32_t cli_bcapi_trace_value(struct cli_bc_ctx *ctx, const uint8_t* name, uint |
314 | 314 |
|
315 | 315 |
uint32_t cli_bcapi_trace_ptr(struct cli_bc_ctx *ctx, const uint8_t* ptr, uint32_t dummy) |
316 | 316 |
{ |
317 |
+ UNUSEDPARAM(dummy); |
|
317 | 318 |
if (LIKELY(ctx->trace_level < trace_val)) |
318 | 319 |
return 0; |
319 | 320 |
if (ctx->trace_level&0x80) { |
... | ... |
@@ -395,7 +402,7 @@ int32_t cli_bcapi_file_find_limit(struct cli_bc_ctx *ctx , const uint8_t* data, |
395 | 395 |
for (;;) { |
396 | 396 |
const char *p; |
397 | 397 |
int32_t readlen = sizeof(buf); |
398 |
- if (off + readlen > limit) { |
|
398 |
+ if (off + readlen > (unsigned int)limit) { |
|
399 | 399 |
readlen = limit - off; |
400 | 400 |
if (readlen < 0) |
401 | 401 |
return -1; |
... | ... |
@@ -463,6 +470,7 @@ int32_t cli_bcapi_fill_buffer(struct cli_bc_ctx *ctx, uint8_t* buf, |
463 | 463 |
uint32_t pos, uint32_t fill) |
464 | 464 |
{ |
465 | 465 |
int32_t res, remaining, tofill; |
466 |
+ UNUSEDPARAM(fill); |
|
466 | 467 |
if (!buf || !buflen || buflen > CLI_MAX_ALLOCATION || filled > buflen) { |
467 | 468 |
cli_dbgmsg("fill_buffer1\n"); |
468 | 469 |
API_MISUSE(); |
... | ... |
@@ -586,7 +594,7 @@ int32_t cli_bcapi_hashset_new(struct cli_bc_ctx *ctx ) |
586 | 586 |
|
587 | 587 |
static struct cli_hashset *get_hashset(struct cli_bc_ctx *ctx, int32_t id) |
588 | 588 |
{ |
589 |
- if (id < 0 || id >= ctx->nhashsets || !ctx->hashsets) { |
|
589 |
+ if (id < 0 || (unsigned int)id >= ctx->nhashsets || !ctx->hashsets) { |
|
590 | 590 |
API_MISUSE(); |
591 | 591 |
return NULL; |
592 | 592 |
} |
... | ... |
@@ -629,7 +637,7 @@ int32_t cli_bcapi_hashset_done(struct cli_bc_ctx *ctx , int32_t id) |
629 | 629 |
if (!s) |
630 | 630 |
return -1; |
631 | 631 |
cli_hashset_destroy(s); |
632 |
- if (id == ctx->nhashsets-1) { |
|
632 |
+ if ((unsigned int)id == ctx->nhashsets-1) { |
|
633 | 633 |
ctx->nhashsets--; |
634 | 634 |
if (!ctx->nhashsets) { |
635 | 635 |
free(ctx->hashsets); |
... | ... |
@@ -693,7 +701,7 @@ int32_t cli_bcapi_buffer_pipe_new_fromfile(struct cli_bc_ctx *ctx , uint32_t at) |
693 | 693 |
|
694 | 694 |
static struct bc_buffer *get_buffer(struct cli_bc_ctx *ctx, int32_t id) |
695 | 695 |
{ |
696 |
- if (!ctx->buffers || id < 0 || id >= ctx->nbuffers) { |
|
696 |
+ if (!ctx->buffers || id < 0 || (unsigned int)id >= ctx->nbuffers) { |
|
697 | 697 |
cli_dbgmsg("bytecode api: invalid buffer id %u\n", id); |
698 | 698 |
return NULL; |
699 | 699 |
} |
... | ... |
@@ -839,7 +847,7 @@ int32_t cli_bcapi_inflate_init(struct cli_bc_ctx *ctx, int32_t from, int32_t to, |
839 | 839 |
|
840 | 840 |
static struct bc_inflate *get_inflate(struct cli_bc_ctx *ctx, int32_t id) |
841 | 841 |
{ |
842 |
- if (id < 0 || id >= ctx->ninflates || !ctx->inflates) |
|
842 |
+ if (id < 0 || (unsigned int)id >= ctx->ninflates || !ctx->inflates) |
|
843 | 843 |
return NULL; |
844 | 844 |
return &ctx->inflates[id]; |
845 | 845 |
} |
... | ... |
@@ -921,6 +929,7 @@ int32_t cli_bcapi_bytecode_rt_error(struct cli_bc_ctx *ctx , int32_t id) |
921 | 921 |
{ |
922 | 922 |
int32_t line = id >> 8; |
923 | 923 |
int32_t col = id&0xff; |
924 |
+ UNUSEDPARAM(ctx); |
|
924 | 925 |
cli_warnmsg("Bytecode runtime error at line %u, col %u\n", line, col); |
925 | 926 |
return 0; |
926 | 927 |
} |
... | ... |
@@ -963,7 +972,7 @@ int32_t cli_bcapi_jsnorm_init(struct cli_bc_ctx *ctx, int32_t from) |
963 | 963 |
|
964 | 964 |
static struct bc_jsnorm *get_jsnorm(struct cli_bc_ctx *ctx, int32_t id) |
965 | 965 |
{ |
966 |
- if (id < 0 || id >= ctx->njsnorms || !ctx->jsnorms) |
|
966 |
+ if (id < 0 || (unsigned int)id >= ctx->njsnorms || !ctx->jsnorms) |
|
967 | 967 |
return NULL; |
968 | 968 |
return &ctx->jsnorms[id]; |
969 | 969 |
} |
... | ... |
@@ -1013,6 +1022,7 @@ static inline double myround(double a) |
1013 | 1013 |
int32_t cli_bcapi_ilog2(struct cli_bc_ctx *ctx, uint32_t a, uint32_t b) |
1014 | 1014 |
{ |
1015 | 1015 |
double f; |
1016 |
+ UNUSEDPARAM(ctx); |
|
1016 | 1017 |
if (!b) |
1017 | 1018 |
return 0x7fffffff; |
1018 | 1019 |
/* log(a/b) is -32..32, so 2^26*32=2^31 covers the entire range of int32 */ |
... | ... |
@@ -1022,6 +1032,7 @@ int32_t cli_bcapi_ilog2(struct cli_bc_ctx *ctx, uint32_t a, uint32_t b) |
1022 | 1022 |
|
1023 | 1023 |
int32_t cli_bcapi_ipow(struct cli_bc_ctx *ctx, int32_t a, int32_t b, int32_t c) |
1024 | 1024 |
{ |
1025 |
+ UNUSEDPARAM(ctx); |
|
1025 | 1026 |
if (!a && b < 0) |
1026 | 1027 |
return 0x7fffffff; |
1027 | 1028 |
return (int32_t)myround(c*pow(a,b)); |
... | ... |
@@ -1030,6 +1041,7 @@ int32_t cli_bcapi_ipow(struct cli_bc_ctx *ctx, int32_t a, int32_t b, int32_t c) |
1030 | 1030 |
uint32_t cli_bcapi_iexp(struct cli_bc_ctx *ctx, int32_t a, int32_t b, int32_t c) |
1031 | 1031 |
{ |
1032 | 1032 |
double f; |
1033 |
+ UNUSEDPARAM(ctx); |
|
1033 | 1034 |
if (!b) |
1034 | 1035 |
return 0x7fffffff; |
1035 | 1036 |
f= c*exp((double)a/b); |
... | ... |
@@ -1039,6 +1051,7 @@ uint32_t cli_bcapi_iexp(struct cli_bc_ctx *ctx, int32_t a, int32_t b, int32_t c) |
1039 | 1039 |
int32_t cli_bcapi_isin(struct cli_bc_ctx *ctx, int32_t a, int32_t b, int32_t c) |
1040 | 1040 |
{ |
1041 | 1041 |
double f; |
1042 |
+ UNUSEDPARAM(ctx); |
|
1042 | 1043 |
if (!b) |
1043 | 1044 |
return 0x7fffffff; |
1044 | 1045 |
f = c*sin((double)a/b); |
... | ... |
@@ -1048,6 +1061,7 @@ int32_t cli_bcapi_isin(struct cli_bc_ctx *ctx, int32_t a, int32_t b, int32_t c) |
1048 | 1048 |
int32_t cli_bcapi_icos(struct cli_bc_ctx *ctx, int32_t a, int32_t b, int32_t c) |
1049 | 1049 |
{ |
1050 | 1050 |
double f; |
1051 |
+ UNUSEDPARAM(ctx); |
|
1051 | 1052 |
if (!b) |
1052 | 1053 |
return 0x7fffffff; |
1053 | 1054 |
f = c*cos((double)a/b); |
... | ... |
@@ -1074,6 +1088,8 @@ int32_t cli_bcapi_hex2ui(struct cli_bc_ctx *ctx, uint32_t ah, uint32_t bh) |
1074 | 1074 |
{ |
1075 | 1075 |
char result = 0; |
1076 | 1076 |
unsigned char in[2]; |
1077 |
+ UNUSEDPARAM(ctx); |
|
1078 |
+ |
|
1077 | 1079 |
in[0] = ah; |
1078 | 1080 |
in[1] = bh; |
1079 | 1081 |
|
... | ... |
@@ -1086,6 +1102,8 @@ int32_t cli_bcapi_atoi(struct cli_bc_ctx *ctx, const uint8_t* str, int32_t len) |
1086 | 1086 |
{ |
1087 | 1087 |
int32_t number = 0; |
1088 | 1088 |
const uint8_t *end = str + len; |
1089 |
+ UNUSEDPARAM(ctx); |
|
1090 |
+ |
|
1089 | 1091 |
while (isspace(*str) && str < end) str++; |
1090 | 1092 |
if (str == end) |
1091 | 1093 |
return -1;/* all spaces */ |
... | ... |
@@ -1104,6 +1122,8 @@ int32_t cli_bcapi_atoi(struct cli_bc_ctx *ctx, const uint8_t* str, int32_t len) |
1104 | 1104 |
|
1105 | 1105 |
uint32_t cli_bcapi_debug_print_str_start(struct cli_bc_ctx *ctx , const uint8_t* s, uint32_t len) |
1106 | 1106 |
{ |
1107 |
+ UNUSEDPARAM(ctx); |
|
1108 |
+ |
|
1107 | 1109 |
if (!s || len <= 0) |
1108 | 1110 |
return -1; |
1109 | 1111 |
cli_event_fastdata(EV, BCEV_DBG_STR, s, len); |
... | ... |
@@ -1113,6 +1133,8 @@ uint32_t cli_bcapi_debug_print_str_start(struct cli_bc_ctx *ctx , const uint8_t* |
1113 | 1113 |
|
1114 | 1114 |
uint32_t cli_bcapi_debug_print_str_nonl(struct cli_bc_ctx *ctx , const uint8_t* s, uint32_t len) |
1115 | 1115 |
{ |
1116 |
+ UNUSEDPARAM(ctx); |
|
1117 |
+ |
|
1116 | 1118 |
if (!s || len <= 0) |
1117 | 1119 |
return -1; |
1118 | 1120 |
if (!cli_debug_flag) |
... | ... |
@@ -1123,14 +1145,16 @@ uint32_t cli_bcapi_debug_print_str_nonl(struct cli_bc_ctx *ctx , const uint8_t* |
1123 | 1123 |
uint32_t cli_bcapi_entropy_buffer(struct cli_bc_ctx *ctx , uint8_t* s, int32_t len) |
1124 | 1124 |
{ |
1125 | 1125 |
uint32_t probTable[256]; |
1126 |
- unsigned i; |
|
1126 |
+ unsigned int i; |
|
1127 | 1127 |
double entropy = 0; |
1128 | 1128 |
double log2 = log(2); |
1129 | 1129 |
|
1130 |
+ UNUSEDPARAM(ctx); |
|
1131 |
+ |
|
1130 | 1132 |
if (!s || len <= 0) |
1131 | 1133 |
return -1; |
1132 | 1134 |
memset(probTable, 0, sizeof(probTable)); |
1133 |
- for (i=0;i<len;i++) { |
|
1135 |
+ for (i=0;i<(unsigned int)len;i++) { |
|
1134 | 1136 |
probTable[s[i]]++; |
1135 | 1137 |
} |
1136 | 1138 |
for (i=0;i<256;i++) { |
... | ... |
@@ -1162,7 +1186,7 @@ int32_t cli_bcapi_map_new(struct cli_bc_ctx *ctx, int32_t keysize, int32_t value |
1162 | 1162 |
|
1163 | 1163 |
static struct cli_map *get_hashtab(struct cli_bc_ctx *ctx, int32_t id) |
1164 | 1164 |
{ |
1165 |
- if (id < 0 || id >= ctx->nmaps || !ctx->maps) |
|
1165 |
+ if (id < 0 || (unsigned int)id >= ctx->nmaps || !ctx->maps) |
|
1166 | 1166 |
return NULL; |
1167 | 1167 |
return &ctx->maps[id]; |
1168 | 1168 |
} |
... | ... |
@@ -1223,7 +1247,7 @@ int32_t cli_bcapi_map_done(struct cli_bc_ctx *ctx , int32_t id) |
1223 | 1223 |
if (!s) |
1224 | 1224 |
return -1; |
1225 | 1225 |
cli_map_delete(s); |
1226 |
- if (id == ctx->nmaps-1) { |
|
1226 |
+ if ((unsigned int)id == ctx->nmaps-1) { |
|
1227 | 1227 |
ctx->nmaps--; |
1228 | 1228 |
if (!ctx->nmaps) { |
1229 | 1229 |
free(ctx->maps); |
... | ... |
@@ -1239,11 +1263,13 @@ int32_t cli_bcapi_map_done(struct cli_bc_ctx *ctx , int32_t id) |
1239 | 1239 |
|
1240 | 1240 |
uint32_t cli_bcapi_engine_functionality_level(struct cli_bc_ctx *ctx) |
1241 | 1241 |
{ |
1242 |
+ UNUSEDPARAM(ctx); |
|
1242 | 1243 |
return cl_retflevel(); |
1243 | 1244 |
} |
1244 | 1245 |
|
1245 | 1246 |
uint32_t cli_bcapi_engine_dconf_level(struct cli_bc_ctx *ctx) |
1246 | 1247 |
{ |
1248 |
+ UNUSEDPARAM(ctx); |
|
1247 | 1249 |
return CL_FLEVEL_DCONF; |
1248 | 1250 |
} |
1249 | 1251 |
|
... | ... |
@@ -1270,7 +1296,7 @@ int32_t cli_bcapi_extract_set_container(struct cli_bc_ctx *ctx, uint32_t ftype) |
1270 | 1270 |
int32_t cli_bcapi_input_switch(struct cli_bc_ctx *ctx , int32_t extracted_file) |
1271 | 1271 |
{ |
1272 | 1272 |
fmap_t *map; |
1273 |
- if (ctx->extracted_file_input == extracted_file) |
|
1273 |
+ if (ctx->extracted_file_input == (unsigned int)extracted_file) |
|
1274 | 1274 |
return 0; |
1275 | 1275 |
if (!extracted_file) { |
1276 | 1276 |
cli_dbgmsg("bytecode api: input switched back to main file\n"); |
... | ... |
@@ -1304,6 +1330,7 @@ uint32_t cli_bcapi_get_environment(struct cli_bc_ctx *ctx , struct cli_environme |
1304 | 1304 |
|
1305 | 1305 |
uint32_t cli_bcapi_disable_bytecode_if(struct cli_bc_ctx *ctx , const int8_t* reason, uint32_t len, uint32_t cond) |
1306 | 1306 |
{ |
1307 |
+ UNUSEDPARAM(len); |
|
1307 | 1308 |
if (ctx->bc->kind != BC_STARTUP) { |
1308 | 1309 |
cli_dbgmsg("Bytecode must be BC_STARTUP to call disable_bytecode_if\n"); |
1309 | 1310 |
return -1; |
... | ... |
@@ -1320,6 +1347,7 @@ uint32_t cli_bcapi_disable_bytecode_if(struct cli_bc_ctx *ctx , const int8_t* re |
1320 | 1320 |
|
1321 | 1321 |
uint32_t cli_bcapi_disable_jit_if(struct cli_bc_ctx *ctx , const int8_t* reason, uint32_t len, uint32_t cond) |
1322 | 1322 |
{ |
1323 |
+ UNUSEDPARAM(len); |
|
1323 | 1324 |
if (ctx->bc->kind != BC_STARTUP) { |
1324 | 1325 |
cli_dbgmsg("Bytecode must be BC_STARTUP to call disable_jit_if\n"); |
1325 | 1326 |
return -1; |
... | ... |
@@ -1340,6 +1368,7 @@ int32_t cli_bcapi_version_compare(struct cli_bc_ctx *ctx , const uint8_t* lhs, u |
1340 | 1340 |
{ |
1341 | 1341 |
unsigned i = 0, j = 0; |
1342 | 1342 |
unsigned long li=0, ri=0; |
1343 |
+ UNUSEDPARAM(ctx); |
|
1343 | 1344 |
do { |
1344 | 1345 |
while (i < lhs_len && j < rhs_len && lhs[i] == rhs[j] && |
1345 | 1346 |
!isdigit(lhs[i]) && !isdigit(rhs[j])) { |
... | ... |
@@ -1451,11 +1480,11 @@ int32_t cli_bcapi_pdf_lookupobj(struct cli_bc_ctx *ctx , uint32_t objid) |
1451 | 1451 |
uint32_t cli_bcapi_pdf_getobjsize(struct cli_bc_ctx *ctx , int32_t objidx) |
1452 | 1452 |
{ |
1453 | 1453 |
if (!ctx->pdf_phase || |
1454 |
- objidx >= ctx->pdf_nobjs || |
|
1454 |
+ (uint32_t)objidx >= ctx->pdf_nobjs || |
|
1455 | 1455 |
ctx->pdf_phase == PDF_PHASE_POSTDUMP /* map is obj itself, no access to pdf anymore */ |
1456 | 1456 |
) |
1457 | 1457 |
return 0; |
1458 |
- if (objidx + 1 == ctx->pdf_nobjs) |
|
1458 |
+ if ((uint32_t)(objidx + 1) == ctx->pdf_nobjs) |
|
1459 | 1459 |
return ctx->pdf_size - ctx->pdf_objs[objidx].start; |
1460 | 1460 |
return ctx->pdf_objs[objidx+1].start - ctx->pdf_objs[objidx].start - 4; |
1461 | 1461 |
} |
... | ... |
@@ -1471,7 +1500,7 @@ const uint8_t* cli_bcapi_pdf_getobj(struct cli_bc_ctx *ctx , int32_t objidx, uin |
1471 | 1471 |
int32_t cli_bcapi_pdf_getobjid(struct cli_bc_ctx *ctx , int32_t objidx) |
1472 | 1472 |
{ |
1473 | 1473 |
if (!ctx->pdf_phase || |
1474 |
- objidx >= ctx->pdf_nobjs) |
|
1474 |
+ (uint32_t)objidx >= ctx->pdf_nobjs) |
|
1475 | 1475 |
return -1; |
1476 | 1476 |
return ctx->pdf_objs[objidx].id; |
1477 | 1477 |
} |
... | ... |
@@ -1479,7 +1508,7 @@ int32_t cli_bcapi_pdf_getobjid(struct cli_bc_ctx *ctx , int32_t objidx) |
1479 | 1479 |
int32_t cli_bcapi_pdf_getobjflags(struct cli_bc_ctx *ctx , int32_t objidx) |
1480 | 1480 |
{ |
1481 | 1481 |
if (!ctx->pdf_phase || |
1482 |
- objidx >= ctx->pdf_nobjs) |
|
1482 |
+ (uint32_t)objidx >= ctx->pdf_nobjs) |
|
1483 | 1483 |
return -1; |
1484 | 1484 |
return ctx->pdf_objs[objidx].flags; |
1485 | 1485 |
} |
... | ... |
@@ -1487,7 +1516,7 @@ int32_t cli_bcapi_pdf_getobjflags(struct cli_bc_ctx *ctx , int32_t objidx) |
1487 | 1487 |
int32_t cli_bcapi_pdf_setobjflags(struct cli_bc_ctx *ctx , int32_t objidx, int32_t flags) |
1488 | 1488 |
{ |
1489 | 1489 |
if (!ctx->pdf_phase || |
1490 |
- objidx >= ctx->pdf_nobjs) |
|
1490 |
+ (uint32_t)objidx >= ctx->pdf_nobjs) |
|
1491 | 1491 |
return -1; |
1492 | 1492 |
cli_dbgmsg("cli_pdf: bytecode setobjflags %08x -> %08x\n", |
1493 | 1493 |
ctx->pdf_objs[objidx].flags, |
... | ... |
@@ -1499,7 +1528,7 @@ int32_t cli_bcapi_pdf_setobjflags(struct cli_bc_ctx *ctx , int32_t objidx, int32 |
1499 | 1499 |
int32_t cli_bcapi_pdf_get_offset(struct cli_bc_ctx *ctx , int32_t objidx) |
1500 | 1500 |
{ |
1501 | 1501 |
if (!ctx->pdf_phase || |
1502 |
- objidx >= ctx->pdf_nobjs) |
|
1502 |
+ (uint32_t)objidx >= ctx->pdf_nobjs) |
|
1503 | 1503 |
return -1; |
1504 | 1504 |
return ctx->pdf_startoff + ctx->pdf_objs[objidx].start; |
1505 | 1505 |
} |
... | ... |
@@ -1536,6 +1565,7 @@ int32_t cli_bcapi_json_is_active(struct cli_bc_ctx *ctx ) |
1536 | 1536 |
return 1; |
1537 | 1537 |
} |
1538 | 1538 |
#else |
1539 |
+ UNUSEDPARAM(ctx); |
|
1539 | 1540 |
cli_dbgmsg("bytecode api: libjson is not enabled!\n"); |
1540 | 1541 |
#endif |
1541 | 1542 |
return 0; |
... | ... |
@@ -1558,6 +1588,7 @@ static int32_t cli_bcapi_json_objs_init(struct cli_bc_ctx *ctx) { |
1558 | 1558 |
|
1559 | 1559 |
return 0; |
1560 | 1560 |
#else |
1561 |
+ UNUSEDPARAM(ctx); |
|
1561 | 1562 |
return -1; |
1562 | 1563 |
#endif |
1563 | 1564 |
} |
... | ... |
@@ -1580,7 +1611,7 @@ int32_t cli_bcapi_json_get_object(struct cli_bc_ctx *ctx, const int8_t* name, in |
1580 | 1580 |
|
1581 | 1581 |
INIT_JSON_OBJS(ctx); |
1582 | 1582 |
jobjs = ((json_object **)(ctx->jsonobjs)); |
1583 |
- if (objid < 0 || objid >= ctx->njsonobjs) { |
|
1583 |
+ if (objid < 0 || (unsigned int)objid >= ctx->njsonobjs) { |
|
1584 | 1584 |
cli_dbgmsg("bytecode api[json_get_object]: invalid json objid requested\n"); |
1585 | 1585 |
return -1; |
1586 | 1586 |
} |
... | ... |
@@ -1619,6 +1650,10 @@ int32_t cli_bcapi_json_get_object(struct cli_bc_ctx *ctx, const int8_t* name, in |
1619 | 1619 |
free(namep); |
1620 | 1620 |
return n-1; |
1621 | 1621 |
#else |
1622 |
+ UNUSEDPARAM(ctx); |
|
1623 |
+ UNUSEDPARAM(name); |
|
1624 |
+ UNUSEDPARAM(name_len); |
|
1625 |
+ UNUSEDPARAM(objid); |
|
1622 | 1626 |
cli_dbgmsg("bytecode api: libjson is not enabled!\n"); |
1623 | 1627 |
return -1; |
1624 | 1628 |
#endif |
... | ... |
@@ -1632,7 +1667,7 @@ int32_t cli_bcapi_json_get_type(struct cli_bc_ctx *ctx, int32_t objid) |
1632 | 1632 |
|
1633 | 1633 |
INIT_JSON_OBJS(ctx); |
1634 | 1634 |
jobjs = ((json_object **)(ctx->jsonobjs)); |
1635 |
- if (objid < 0 || objid >= ctx->njsonobjs) { |
|
1635 |
+ if (objid < 0 || (unsigned int)objid >= ctx->njsonobjs) { |
|
1636 | 1636 |
cli_dbgmsg("bytecode api[json_get_type]: invalid json objid requested\n"); |
1637 | 1637 |
return -1; |
1638 | 1638 |
} |
... | ... |
@@ -1658,6 +1693,8 @@ int32_t cli_bcapi_json_get_type(struct cli_bc_ctx *ctx, int32_t objid) |
1658 | 1658 |
} |
1659 | 1659 |
|
1660 | 1660 |
#else |
1661 |
+ UNUSEDPARAM(ctx); |
|
1662 |
+ UNUSEDPARAM(objid); |
|
1661 | 1663 |
cli_dbgmsg("bytecode api: libjson is not enabled!\n"); |
1662 | 1664 |
#endif |
1663 | 1665 |
return -1; |
... | ... |
@@ -1671,7 +1708,7 @@ int32_t cli_bcapi_json_get_array_length(struct cli_bc_ctx *ctx, int32_t objid) |
1671 | 1671 |
|
1672 | 1672 |
INIT_JSON_OBJS(ctx); |
1673 | 1673 |
jobjs = (json_object **)(ctx->jsonobjs); |
1674 |
- if (objid < 0 || objid >= ctx->njsonobjs) { |
|
1674 |
+ if (objid < 0 || (unsigned int)objid >= ctx->njsonobjs) { |
|
1675 | 1675 |
cli_dbgmsg("bytecode api[json_array_get_length]: invalid json objid requested\n"); |
1676 | 1676 |
return -1; |
1677 | 1677 |
} |
... | ... |
@@ -1683,6 +1720,8 @@ int32_t cli_bcapi_json_get_array_length(struct cli_bc_ctx *ctx, int32_t objid) |
1683 | 1683 |
|
1684 | 1684 |
return json_object_array_length(jobjs[objid]); |
1685 | 1685 |
#else |
1686 |
+ UNUSEDPARAM(ctx); |
|
1687 |
+ UNUSEDPARAM(objid); |
|
1686 | 1688 |
cli_dbgmsg("bytecode api: libjson is not enabled!\n"); |
1687 | 1689 |
return -1; |
1688 | 1690 |
#endif |
... | ... |
@@ -1698,7 +1737,7 @@ int32_t cli_bcapi_json_get_array_idx(struct cli_bc_ctx *ctx, int32_t idx, int32_ |
1698 | 1698 |
|
1699 | 1699 |
INIT_JSON_OBJS(ctx); |
1700 | 1700 |
jobjs = (json_object **)(ctx->jsonobjs); |
1701 |
- if (objid < 0 || objid >= ctx->njsonobjs) { |
|
1701 |
+ if (objid < 0 || (unsigned int)objid >= ctx->njsonobjs) { |
|
1702 | 1702 |
cli_dbgmsg("bytecode api[json_array_get_idx]: invalid json objid requested\n"); |
1703 | 1703 |
return -1; |
1704 | 1704 |
} |
... | ... |
@@ -1736,6 +1775,9 @@ int32_t cli_bcapi_json_get_array_idx(struct cli_bc_ctx *ctx, int32_t idx, int32_ |
1736 | 1736 |
|
1737 | 1737 |
return 0; |
1738 | 1738 |
#else |
1739 |
+ UNUSEDPARAM(ctx); |
|
1740 |
+ UNUSEDPARAM(idx); |
|
1741 |
+ UNUSEDPARAM(objid); |
|
1739 | 1742 |
cli_dbgmsg("bytecode api: libjson is not enabled!\n"); |
1740 | 1743 |
return -1; |
1741 | 1744 |
#endif |
... | ... |
@@ -1751,7 +1793,7 @@ int32_t cli_bcapi_json_get_string_length(struct cli_bc_ctx *ctx, int32_t objid) |
1751 | 1751 |
|
1752 | 1752 |
INIT_JSON_OBJS(ctx); |
1753 | 1753 |
jobjs = (json_object **)(ctx->jsonobjs); |
1754 |
- if (objid < 0 || objid >= ctx->njsonobjs) { |
|
1754 |
+ if (objid < 0 || (unsigned int)objid >= ctx->njsonobjs) { |
|
1755 | 1755 |
cli_dbgmsg("bytecode api[json_get_string_length]: invalid json objid requested\n"); |
1756 | 1756 |
return -1; |
1757 | 1757 |
} |
... | ... |
@@ -1771,6 +1813,8 @@ int32_t cli_bcapi_json_get_string_length(struct cli_bc_ctx *ctx, int32_t objid) |
1771 | 1771 |
|
1772 | 1772 |
return len; |
1773 | 1773 |
#else |
1774 |
+ UNUSEDPARAM(ctx); |
|
1775 |
+ UNUSEDPARAM(objid); |
|
1774 | 1776 |
cli_dbgmsg("bytecode api: libjson is not enabled!\n"); |
1775 | 1777 |
return -1; |
1776 | 1778 |
#endif |
... | ... |
@@ -1786,7 +1830,7 @@ int32_t cli_bcapi_json_get_string(struct cli_bc_ctx *ctx, int8_t* str, int32_t s |
1786 | 1786 |
|
1787 | 1787 |
INIT_JSON_OBJS(ctx); |
1788 | 1788 |
jobjs = (json_object **)(ctx->jsonobjs); |
1789 |
- if (objid < 0 || objid >= ctx->njsonobjs) { |
|
1789 |
+ if (objid < 0 || (unsigned int)objid >= ctx->njsonobjs) { |
|
1790 | 1790 |
cli_dbgmsg("bytecode api[json_get_string]: invalid json objid requested\n"); |
1791 | 1791 |
return -1; |
1792 | 1792 |
} |
... | ... |
@@ -1806,17 +1850,21 @@ int32_t cli_bcapi_json_get_string(struct cli_bc_ctx *ctx, int8_t* str, int32_t s |
1806 | 1806 |
|
1807 | 1807 |
if (len+1 > str_len) { |
1808 | 1808 |
/* limit on str-len */ |
1809 |
- strncpy(str, jstr, str_len-1); |
|
1809 |
+ strncpy((char *)str, jstr, str_len-1); |
|
1810 | 1810 |
str[str_len-1] = '\0'; |
1811 | 1811 |
return str_len; |
1812 | 1812 |
} |
1813 | 1813 |
else { |
1814 | 1814 |
/* limit on len+1 */ |
1815 |
- strncpy(str, jstr, len); |
|
1815 |
+ strncpy((char *)str, jstr, len); |
|
1816 | 1816 |
str[len] = '\0'; |
1817 | 1817 |
return len+1; |
1818 | 1818 |
} |
1819 | 1819 |
#else |
1820 |
+ UNUSEDPARAM(ctx); |
|
1821 |
+ UNUSEDPARAM(str); |
|
1822 |
+ UNUSEDPARAM(str_len); |
|
1823 |
+ UNUSEDPARAM(objid); |
|
1820 | 1824 |
cli_dbgmsg("bytecode api: libjson is not enabled!\n"); |
1821 | 1825 |
return -1; |
1822 | 1826 |
#endif |
... | ... |
@@ -1829,7 +1877,7 @@ int32_t cli_bcapi_json_get_boolean(struct cli_bc_ctx *ctx, int32_t objid) |
1829 | 1829 |
|
1830 | 1830 |
INIT_JSON_OBJS(ctx); |
1831 | 1831 |
jobjs = (json_object **)(ctx->jsonobjs); |
1832 |
- if (objid < 0 || objid >= ctx->njsonobjs) { |
|
1832 |
+ if (objid < 0 || (unsigned int)objid >= ctx->njsonobjs) { |
|
1833 | 1833 |
cli_dbgmsg("bytecode api[json_get_boolean]: invalid json objid requested\n"); |
1834 | 1834 |
return -1; |
1835 | 1835 |
} |
... | ... |
@@ -1837,6 +1885,8 @@ int32_t cli_bcapi_json_get_boolean(struct cli_bc_ctx *ctx, int32_t objid) |
1837 | 1837 |
jobj = jobjs[objid]; |
1838 | 1838 |
return json_object_get_boolean(jobj); |
1839 | 1839 |
#else |
1840 |
+ UNUSEDPARAM(ctx); |
|
1841 |
+ UNUSEDPARAM(objid); |
|
1840 | 1842 |
cli_dbgmsg("bytecode api: libjson is not enabled!\n"); |
1841 | 1843 |
return 0; |
1842 | 1844 |
#endif |
... | ... |
@@ -1849,7 +1899,7 @@ int32_t cli_bcapi_json_get_int(struct cli_bc_ctx *ctx, int32_t objid) |
1849 | 1849 |
|
1850 | 1850 |
INIT_JSON_OBJS(ctx); |
1851 | 1851 |
jobjs = (json_object **)(ctx->jsonobjs); |
1852 |
- if (objid < 0 || objid >= ctx->njsonobjs) { |
|
1852 |
+ if (objid < 0 || (unsigned int)objid >= ctx->njsonobjs) { |
|
1853 | 1853 |
cli_dbgmsg("bytecode api[json_get_int]: invalid json objid requested\n"); |
1854 | 1854 |
return -1; |
1855 | 1855 |
} |
... | ... |
@@ -1857,6 +1907,8 @@ int32_t cli_bcapi_json_get_int(struct cli_bc_ctx *ctx, int32_t objid) |
1857 | 1857 |
jobj = jobjs[objid]; |
1858 | 1858 |
return json_object_get_int(jobj); |
1859 | 1859 |
#else |
1860 |
+ UNUSEDPARAM(ctx); |
|
1861 |
+ UNUSEDPARAM(objid); |
|
1860 | 1862 |
cli_dbgmsg("bytecode api: libjson is not enabled!\n"); |
1861 | 1863 |
return 0; |
1862 | 1864 |
#endif |
... | ... |
@@ -47,21 +47,30 @@ int cli_bytecode_prepare_jit(struct cli_all_bc *bcs) |
47 | 47 |
|
48 | 48 |
int cli_vm_execute_jit(const struct cli_all_bc *bcs, struct cli_bc_ctx *ctx, const struct cli_bc_func *func) |
49 | 49 |
{ |
50 |
+ UNUSEDPARAM(bcs); |
|
51 |
+ UNUSEDPARAM(ctx); |
|
52 |
+ UNUSEDPARAM(func); |
|
50 | 53 |
return CL_EBYTECODE; |
51 | 54 |
} |
52 | 55 |
|
53 | 56 |
int cli_bytecode_init_jit(struct cli_all_bc *allbc, unsigned dconfmask) |
54 | 57 |
{ |
58 |
+ UNUSEDPARAM(allbc); |
|
59 |
+ UNUSEDPARAM(dconfmask); |
|
55 | 60 |
return CL_SUCCESS; |
56 | 61 |
} |
57 | 62 |
|
58 | 63 |
int cli_bytecode_done_jit(struct cli_all_bc *allbc, int partial) |
59 | 64 |
{ |
65 |
+ UNUSEDPARAM(allbc); |
|
66 |
+ UNUSEDPARAM(partial); |
|
60 | 67 |
return CL_SUCCESS; |
61 | 68 |
} |
62 | 69 |
|
63 | 70 |
void cli_bytecode_debug(int argc, char **argv) { |
64 | 71 |
/* Empty */ |
72 |
+ UNUSEDPARAM(argc); |
|
73 |
+ UNUSEDPARAM(argv); |
|
65 | 74 |
} |
66 | 75 |
|
67 | 76 |
int bytecode_init(void) |
... | ... |
@@ -71,6 +80,7 @@ int bytecode_init(void) |
71 | 71 |
|
72 | 72 |
void cli_bytecode_debug_printsrc(const struct cli_bc_ctx *ctx) { |
73 | 73 |
/* Empty */ |
74 |
+ UNUSEDPARAM(ctx); |
|
74 | 75 |
} |
75 | 76 |
void cli_bytecode_printversion(void) { |
76 | 77 |
printf("LLVM not compiled in\n"); |
... | ... |
@@ -83,4 +93,5 @@ void cli_printcxxver() |
83 | 83 |
void cli_detect_env_jit(struct cli_environment *env) |
84 | 84 |
{ |
85 | 85 |
/* Empty */ |
86 |
+ UNUSEDPARAM(env); |
|
86 | 87 |
} |
... | ... |
@@ -555,13 +555,6 @@ static inline int64_t ptr_register_glob(struct ptr_infos *infos, |
555 | 555 |
return ptr_register_glob_fixedid(infos, values, size, infos->nglobs+1); |
556 | 556 |
} |
557 | 557 |
|
558 |
-static inline int64_t ptr_index(int64_t ptr, uint32_t off) |
|
559 |
-{ |
|
560 |
- int32_t ptrid = ptr >> 32; |
|
561 |
- uint32_t ptroff = (uint32_t)ptr; |
|
562 |
- return ptr_compose(ptrid, ptroff+off); |
|
563 |
-} |
|
564 |
- |
|
565 | 558 |
static inline void* ptr_torealptr(const struct ptr_infos *infos, int64_t ptr, |
566 | 559 |
uint32_t read_size) |
567 | 560 |
{ |
... | ... |
@@ -575,14 +568,14 @@ static inline void* ptr_torealptr(const struct ptr_infos *infos, int64_t ptr, |
575 | 575 |
} |
576 | 576 |
if (ptrid < 0) { |
577 | 577 |
ptrid = -ptrid-1; |
578 |
- if (UNLIKELY(ptrid >= infos->nstacks)) { |
|
578 |
+ if (UNLIKELY((const unsigned int)ptrid >= infos->nstacks)) { |
|
579 | 579 |
(void)bcfail("ptr", ptrid, infos->nstacks, __FILE__, __LINE__); |
580 | 580 |
return NULL; |
581 | 581 |
} |
582 | 582 |
info = &infos->stack_infos[ptrid]; |
583 | 583 |
} else { |
584 | 584 |
ptrid--; |
585 |
- if (UNLIKELY(ptrid >= infos->nglobs)) { |
|
585 |
+ if (UNLIKELY((const unsigned int)ptrid >= infos->nglobs)) { |
|
586 | 586 |
(void)bcfail("ptr", ptrid, infos->nglobs, __FILE__, __LINE__); |
587 | 587 |
return NULL; |
588 | 588 |
} |
... | ... |
@@ -932,7 +932,7 @@ int cache_check(unsigned char *hash, cli_ctx *ctx) { |
932 | 932 |
todo -= readme; |
933 | 933 |
at += readme; |
934 | 934 |
|
935 |
- if (cl_update_hash(hashctx, buf, readme)) { |
|
935 |
+ if (cl_update_hash(hashctx, (void *)buf, readme)) { |
|
936 | 936 |
cl_hash_destroy(hashctx); |
937 | 937 |
cli_errmsg("cache_check: error reading while generating hash!\n"); |
938 | 938 |
return CL_EREAD; |
... | ... |
@@ -69,7 +69,7 @@ static size_t base64_len(const char *data, size_t len) |
69 | 69 |
void *cl_base64_decode(char *data, size_t len, void *obuf, size_t *olen) |
70 | 70 |
{ |
71 | 71 |
BIO *bio, *b64; |
72 |
- void *buf, *ret; |
|
72 |
+ void *buf; |
|
73 | 73 |
|
74 | 74 |
buf = (obuf) ? obuf : malloc(base64_len(data, len)+1); |
75 | 75 |
if (!(buf)) |
... | ... |
@@ -124,7 +124,7 @@ int cli_scancpio_old(cli_ctx *ctx) |
124 | 124 |
if(hdr_old.namesize) { |
125 | 125 |
hdr_namesize = EC16(hdr_old.namesize, conv); |
126 | 126 |
namesize = MIN(sizeof(name), hdr_namesize); |
127 |
- if (fmap_readn(*ctx->fmap, &name, pos, namesize) != namesize) { |
|
127 |
+ if ((uint32_t)fmap_readn(*ctx->fmap, &name, pos, namesize) != namesize) { |
|
128 | 128 |
cli_dbgmsg("cli_scancpio_old: Can't read file name\n"); |
129 | 129 |
return CL_EFORMAT; |
130 | 130 |
} |
... | ... |
@@ -202,7 +202,7 @@ int cli_scancpio_odc(cli_ctx *ctx) |
202 | 202 |
} |
203 | 203 |
if(hdr_namesize) { |
204 | 204 |
namesize = MIN(sizeof(name), hdr_namesize); |
205 |
- if (fmap_readn(*ctx->fmap, &name, pos, namesize) != namesize) { |
|
205 |
+ if ((uint32_t)fmap_readn(*ctx->fmap, &name, pos, namesize) != namesize) { |
|
206 | 206 |
cli_dbgmsg("cli_scancpio_odc: Can't read file name\n"); |
207 | 207 |
return CL_EFORMAT; |
208 | 208 |
} |
... | ... |
@@ -276,7 +276,7 @@ int cli_scancpio_newc(cli_ctx *ctx, int crc) |
276 | 276 |
} |
277 | 277 |
if(hdr_namesize) { |
278 | 278 |
namesize = MIN(sizeof(name), hdr_namesize); |
279 |
- if (fmap_readn(*ctx->fmap, &name, pos, namesize) != namesize) { |
|
279 |
+ if ((uint32_t)fmap_readn(*ctx->fmap, &name, pos, namesize) != namesize) { |
|
280 | 280 |
cli_dbgmsg("cli_scancpio_newc: Can't read file name\n"); |
281 | 281 |
return CL_EFORMAT; |
282 | 282 |
} |
... | ... |
@@ -41,6 +41,7 @@ int cli_crt_init(cli_crt *x509) { |
41 | 41 |
} |
42 | 42 |
|
43 | 43 |
void cli_crt_clear(cli_crt *x509) { |
44 |
+ UNUSEDPARAM(x509); |
|
44 | 45 |
mp_clear_multi(&x509->n, &x509->e, &x509->sig, NULL); |
45 | 46 |
} |
46 | 47 |
|
... | ... |
@@ -337,104 +338,8 @@ cli_crt *crtmgr_verify_pkcs7(crtmgr *m, const uint8_t *issuer, const uint8_t *se |
337 | 337 |
return i; |
338 | 338 |
} |
339 | 339 |
|
340 |
-/* DC=com, DC=microsoft, CN=Microsoft Root Certificate Authority */ |
|
341 |
-static const uint8_t MSCA_SUBJECT[] = "\x11\x3b\xd8\x6b\xed\xde\xbc\xd4\xc5\xf1\x0a\xa0\x7a\xb2\x02\x6b\x98\x2f\x4b\x92"; |
|
342 |
-static const uint8_t MSCA_MOD[] = "\ |
|
343 |
-\x00\xf3\x5d\xfa\x80\x67\xd4\x5a\xa7\xa9\x0c\x2c\x90\x20\xd0\ |
|
344 |
-\x35\x08\x3c\x75\x84\xcd\xb7\x07\x89\x9c\x89\xda\xde\xce\xc3\ |
|
345 |
-\x60\xfa\x91\x68\x5a\x9e\x94\x71\x29\x18\x76\x7c\xc2\xe0\xc8\ |
|
346 |
-\x25\x76\x94\x0e\x58\xfa\x04\x34\x36\xe6\xdf\xaf\xf7\x80\xba\ |
|
347 |
-\xe9\x58\x0b\x2b\x93\xe5\x9d\x05\xe3\x77\x22\x91\xf7\x34\x64\ |
|
348 |
-\x3c\x22\x91\x1d\x5e\xe1\x09\x90\xbc\x14\xfe\xfc\x75\x58\x19\ |
|
349 |
-\xe1\x79\xb7\x07\x92\xa3\xae\x88\x59\x08\xd8\x9f\x07\xca\x03\ |
|
350 |
-\x58\xfc\x68\x29\x6d\x32\xd7\xd2\xa8\xcb\x4b\xfc\xe1\x0b\x48\ |
|
351 |
-\x32\x4f\xe6\xeb\xb8\xad\x4f\xe4\x5c\x6f\x13\x94\x99\xdb\x95\ |
|
352 |
-\xd5\x75\xdb\xa8\x1a\xb7\x94\x91\xb4\x77\x5b\xf5\x48\x0c\x8f\ |
|
353 |
-\x6a\x79\x7d\x14\x70\x04\x7d\x6d\xaf\x90\xf5\xda\x70\xd8\x47\ |
|
354 |
-\xb7\xbf\x9b\x2f\x6c\xe7\x05\xb7\xe1\x11\x60\xac\x79\x91\x14\ |
|
355 |
-\x7c\xc5\xd6\xa6\xe4\xe1\x7e\xd5\xc3\x7e\xe5\x92\xd2\x3c\x00\ |
|
356 |
-\xb5\x36\x82\xde\x79\xe1\x6d\xf3\xb5\x6e\xf8\x9f\x33\xc9\xcb\ |
|
357 |
-\x52\x7d\x73\x98\x36\xdb\x8b\xa1\x6b\xa2\x95\x97\x9b\xa3\xde\ |
|
358 |
-\xc2\x4d\x26\xff\x06\x96\x67\x25\x06\xc8\xe7\xac\xe4\xee\x12\ |
|
359 |
-\x33\x95\x31\x99\xc8\x35\x08\x4e\x34\xca\x79\x53\xd5\xb5\xbe\ |
|
360 |
-\x63\x32\x59\x40\x36\xc0\xa5\x4e\x04\x4d\x3d\xdb\x5b\x07\x33\ |
|
361 |
-\xe4\x58\xbf\xef\x3f\x53\x64\xd8\x42\x59\x35\x57\xfd\x0f\x45\ |
|
362 |
-\x7c\x24\x04\x4d\x9e\xd6\x38\x74\x11\x97\x22\x90\xce\x68\x44\ |
|
363 |
-\x74\x92\x6f\xd5\x4b\x6f\xb0\x86\xe3\xc7\x36\x42\xa0\xd0\xfc\ |
|
364 |
-\xc1\xc0\x5a\xf9\xa3\x61\xb9\x30\x47\x71\x96\x0a\x16\xb0\x91\ |
|
365 |
-\xc0\x42\x95\xef\x10\x7f\x28\x6a\xe3\x2a\x1f\xb1\xe4\xcd\x03\ |
|
366 |
-\x3f\x77\x71\x04\xc7\x20\xfc\x49\x0f\x1d\x45\x88\xa4\xd7\xcb\ |
|
367 |
-\x7e\x88\xad\x8e\x2d\xec\x45\xdb\xc4\x51\x04\xc9\x2a\xfc\xec\ |
|
368 |
-\x86\x9e\x9a\x11\x97\x5b\xde\xce\x53\x88\xe6\xe2\xb7\xfd\xac\ |
|
369 |
-\x95\xc2\x28\x40\xdb\xef\x04\x90\xdf\x81\x33\x39\xd9\xb2\x45\ |
|
370 |
-\xa5\x23\x87\x06\xa5\x55\x89\x31\xbb\x06\x2d\x60\x0e\x41\x18\ |
|
371 |
-\x7d\x1f\x2e\xb5\x97\xcb\x11\xeb\x15\xd5\x24\xa5\x94\xef\x15\ |
|
372 |
-\x14\x89\xfd\x4b\x73\xfa\x32\x5b\xfc\xd1\x33\x00\xf9\x59\x62\ |
|
373 |
-\x70\x07\x32\xea\x2e\xab\x40\x2d\x7b\xca\xdd\x21\x67\x1b\x30\ |
|
374 |
-\x99\x8f\x16\xaa\x23\xa8\x41\xd1\xb0\x6e\x11\x9b\x36\xc4\xde\ |
|
375 |
-\x40\x74\x9c\xe1\x58\x65\xc1\x60\x1e\x7a\x5b\x38\xc8\x8f\xbb\ |
|
376 |
-\x04\x26\x7c\xd4\x16\x40\xe5\xb6\x6b\x6c\xaa\x86\xfd\x00\xbf\ |
|
377 |
-\xce\xc1\x35"; |
|
378 |
-static const uint8_t MSCA_EXP[] = "\x01\x00\x01"; |
|
379 |
- |
|
380 |
-/* OU=Copyright (c) 1997 Microsoft Corp., OU=Microsoft Corporation, CN=Microsoft Root Authority */ |
|
381 |
-static const uint8_t MSA_SUBJECT[] = "\xad\xf7\x98\x77\x06\x5e\xf3\x05\xeb\x95\xb5\x6d\xbc\xa9\xe6\x3e\x9a\xb4\x0d\x3b"; |
|
382 |
-static const uint8_t MSA_MOD[] = "\ |
|
383 |
-\x00\xa9\x02\xbd\xc1\x70\xe6\x3b\xf2\x4e\x1b\x28\x9f\x97\x78\ |
|
384 |
-\x5e\x30\xea\xa2\xa9\x8d\x25\x5f\xf8\xfe\x95\x4c\xa3\xb7\xfe\ |
|
385 |
-\x9d\xa2\x20\x3e\x7c\x51\xa2\x9b\xa2\x8f\x60\x32\x6b\xd1\x42\ |
|
386 |
-\x64\x79\xee\xac\x76\xc9\x54\xda\xf2\xeb\x9c\x86\x1c\x8f\x9f\ |
|
387 |
-\x84\x66\xb3\xc5\x6b\x7a\x62\x23\xd6\x1d\x3c\xde\x0f\x01\x92\ |
|
388 |
-\xe8\x96\xc4\xbf\x2d\x66\x9a\x9a\x68\x26\x99\xd0\x3a\x2c\xbf\ |
|
389 |
-\x0c\xb5\x58\x26\xc1\x46\xe7\x0a\x3e\x38\x96\x2c\xa9\x28\x39\ |
|
390 |
-\xa8\xec\x49\x83\x42\xe3\x84\x0f\xbb\x9a\x6c\x55\x61\xac\x82\ |
|
391 |
-\x7c\xa1\x60\x2d\x77\x4c\xe9\x99\xb4\x64\x3b\x9a\x50\x1c\x31\ |
|
392 |
-\x08\x24\x14\x9f\xa9\xe7\x91\x2b\x18\xe6\x3d\x98\x63\x14\x60\ |
|
393 |
-\x58\x05\x65\x9f\x1d\x37\x52\x87\xf7\xa7\xef\x94\x02\xc6\x1b\ |
|
394 |
-\xd3\xbf\x55\x45\xb3\x89\x80\xbf\x3a\xec\x54\x94\x4e\xae\xfd\ |
|
395 |
-\xa7\x7a\x6d\x74\x4e\xaf\x18\xcc\x96\x09\x28\x21\x00\x57\x90\ |
|
396 |
-\x60\x69\x37\xbb\x4b\x12\x07\x3c\x56\xff\x5b\xfb\xa4\x66\x0a\ |
|
397 |
-\x08\xa6\xd2\x81\x56\x57\xef\xb6\x3b\x5e\x16\x81\x77\x04\xda\ |
|
398 |
-\xf6\xbe\xae\x80\x95\xfe\xb0\xcd\x7f\xd6\xa7\x1a\x72\x5c\x3c\ |
|
399 |
-\xca\xbc\xf0\x08\xa3\x22\x30\xb3\x06\x85\xc9\xb3\x20\x77\x13\ |
|
400 |
-\x85\xdf"; |
|
401 |
-static const uint8_t MSA_EXP[] = "\x01\x00\x01"; |
|
402 |
- |
|
403 |
- |
|
404 |
-/* C=ZA, ST=Western Cape, L=Durbanville, O=Thawte, OU=Thawte Certification, CN=Thawte Timestamping CA */ |
|
405 |
-static const uint8_t THAW_SUBJECT[] = "\x9a\x02\x27\x8e\x9c\xb1\x28\x76\xc4\x7a\xb0\xbc\x75\xdd\x69\x4e\x72\xd1\xb2\xbc"; |
|
406 |
-static const uint8_t THAW_MOD[] = "\ |
|
407 |
-\x00\xd6\x2b\x58\x78\x61\x45\x86\x53\xea\x34\x7b\x51\x9c\xed\ |
|
408 |
-\xb0\xe6\x2e\x18\x0e\xfe\xe0\x5f\xa8\x27\xd3\xb4\xc9\xe0\x7c\ |
|
409 |
-\x59\x4e\x16\x0e\x73\x54\x60\xc1\x7f\xf6\x9f\x2e\xe9\x3a\x85\ |
|
410 |
-\x24\x15\x3c\xdb\x47\x04\x63\xc3\x9e\xc4\x94\x1a\x5a\xdf\x4c\ |
|
411 |
-\x7a\xf3\xd9\x43\x1d\x3c\x10\x7a\x79\x25\xdb\x90\xfe\xf0\x51\ |
|
412 |
-\xe7\x30\xd6\x41\x00\xfd\x9f\x28\xdf\x79\xbe\x94\xbb\x9d\xb6\ |
|
413 |
-\x14\xe3\x23\x85\xd7\xa9\x41\xe0\x4c\xa4\x79\xb0\x2b\x1a\x8b\ |
|
414 |
-\xf2\xf8\x3b\x8a\x3e\x45\xac\x71\x92\x00\xb4\x90\x41\x98\xfb\ |
|
415 |
-\x5f\xed\xfa\xb7\x2e\x8a\xf8\x88\x37"; |
|
416 |
-const uint8_t THAW_EXP[] = "\x01\x00\x01"; |
|
417 |
- |
|
418 |
- |
|
419 |
-/* C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority */ |
|
420 |
-static const uint8_t VER_SUBJECT[] = "\x29\xdb\xd4\xb8\x8f\x78\x5f\x33\x41\x92\x87\xe1\xaf\x46\x50\xe1\x77\xa4\x6f\xc0"; |
|
421 |
-static const uint8_t VER_MOD[] = "\ |
|
422 |
-\x00\xc9\x5c\x59\x9e\xf2\x1b\x8a\x01\x14\xb4\x10\xdf\x04\x40\ |
|
423 |
-\xdb\xe3\x57\xaf\x6a\x45\x40\x8f\x84\x0c\x0b\xd1\x33\xd9\xd9\ |
|
424 |
-\x11\xcf\xee\x02\x58\x1f\x25\xf7\x2a\xa8\x44\x05\xaa\xec\x03\ |
|
425 |
-\x1f\x78\x7f\x9e\x93\xb9\x9a\x00\xaa\x23\x7d\xd6\xac\x85\xa2\ |
|
426 |
-\x63\x45\xc7\x72\x27\xcc\xf4\x4c\xc6\x75\x71\xd2\x39\xef\x4f\ |
|
427 |
-\x42\xf0\x75\xdf\x0a\x90\xc6\x8e\x20\x6f\x98\x0f\xf8\xac\x23\ |
|
428 |
-\x5f\x70\x29\x36\xa4\xc9\x86\xe7\xb1\x9a\x20\xcb\x53\xa5\x85\ |
|
429 |
-\xe7\x3d\xbe\x7d\x9a\xfe\x24\x45\x33\xdc\x76\x15\xed\x0f\xa2\ |
|
430 |
-\x71\x64\x4c\x65\x2e\x81\x68\x45\xa7"; |
|
431 |
-static const uint8_t VER_EXP[] = "\x01\x00\x01"; |
|
432 |
- |
|
433 |
- |
|
434 | 340 |
int crtmgr_add_roots(struct cl_engine *engine, crtmgr *m) { |
435 |
- cli_crt ca; |
|
436 |
- cli_crt *crt, *new_crt; |
|
437 |
- |
|
341 |
+ cli_crt *crt; |
|
438 | 342 |
/* |
439 | 343 |
* Certs are cached in engine->cmgr. Copy from there. |
440 | 344 |
*/ |
... | ... |
@@ -164,7 +164,7 @@ unsigned char *cl_hash_data(char *alg, const void *buf, size_t len, unsigned cha |
164 | 164 |
|
165 | 165 |
cur=0; |
166 | 166 |
while (cur < len) { |
167 |
- size_t todo = MIN(EVP_MD_block_size(md), len-cur); |
|
167 |
+ size_t todo = MIN((unsigned long)EVP_MD_block_size(md), (unsigned long)(len-cur)); |
|
168 | 168 |
if (!EVP_DigestUpdate(ctx, (void *)(((unsigned char *)buf)+cur), todo)) { |
169 | 169 |
if (!(obuf)) |
170 | 170 |
free(ret); |
... | ... |
@@ -736,7 +736,7 @@ X509 *cl_get_x509_from_mem(void *data, unsigned int len) |
736 | 736 |
|
737 | 737 |
int cl_validate_certificate_chain_ts_dir(char *tsdir, char *certpath) |
738 | 738 |
{ |
739 |
- char **authorities=NULL, **t, *fullpath; |
|
739 |
+ char **authorities=NULL, **t; |
|
740 | 740 |
size_t nauths = 0; |
741 | 741 |
int res; |
742 | 742 |
DIR *dp; |
... | ... |
@@ -964,7 +964,6 @@ struct tm *cl_ASN1_GetTimeT(ASN1_TIME *timeobj) |
964 | 964 |
{ |
965 | 965 |
struct tm *t; |
966 | 966 |
char* str; |
967 |
- size_t i = 0; |
|
968 | 967 |
const char *fmt=NULL; |
969 | 968 |
time_t localt; |
970 | 969 |
#ifdef _WIN32 |
... | ... |
@@ -1032,7 +1031,6 @@ X509_CRL *cl_load_crl(const char *file) |
1032 | 1032 |
X509_CRL *x=NULL; |
1033 | 1033 |
FILE *fp; |
1034 | 1034 |
struct tm *tm; |
1035 |
- time_t crltime; |
|
1036 | 1035 |
|
1037 | 1036 |
if (!(file)) |
1038 | 1037 |
return NULL; |
... | ... |
@@ -47,6 +47,7 @@ |
47 | 47 |
|
48 | 48 |
static void cli_untgz_cleanup(char *path, gzFile infile, FILE *outfile, int fdd) |
49 | 49 |
{ |
50 |
+ UNUSEDPARAM(fdd); |
|
50 | 51 |
cli_dbgmsg("in cli_untgz_cleanup()\n"); |
51 | 52 |
if (path != NULL) |
52 | 53 |
free (path); |
... | ... |
@@ -180,6 +181,7 @@ static int cli_untgz(int fd, const char *destdir) |
180 | 180 |
|
181 | 181 |
static void cli_tgzload_cleanup(int comp, struct cli_dbio *dbio, int fdd) |
182 | 182 |
{ |
183 |
+ UNUSEDPARAM(fdd); |
|
183 | 184 |
cli_dbgmsg("in cli_tgzload_cleanup()\n"); |
184 | 185 |
if(comp) { |
185 | 186 |
gzclose(dbio->gzs); |
... | ... |
@@ -95,10 +95,10 @@ static int dmg_handle_mish(cli_ctx *, unsigned int, char *, uint64_t, struct dmg |
95 | 95 |
int cli_scandmg(cli_ctx *ctx) |
96 | 96 |
{ |
97 | 97 |
struct dmg_koly_block hdr; |
98 |
- int ret, namelen, ofd; |
|
98 |
+ int ret; |
|
99 | 99 |
size_t maplen, nread; |
100 | 100 |
off_t pos = 0; |
101 |
- char *dirname, *tmpfile; |
|
101 |
+ char *dirname; |
|
102 | 102 |
const char *outdata; |
103 | 103 |
unsigned int file = 0; |
104 | 104 |
struct dmg_mish_with_stripes *mish_list = NULL, *mish_list_tail = NULL; |
... | ... |
@@ -255,7 +255,7 @@ int cli_scandmg(cli_ctx *ctx) |
255 | 255 |
/* Reset state early, for continue cases */ |
256 | 256 |
stateDepth[DMG_FIND_KEY_DATA] = -1; |
257 | 257 |
state--; |
258 |
- if (xmlStrcmp(nodeName, "data") != 0) { |
|
258 |
+ if (xmlStrcmp(nodeName, (const xmlChar *)"data") != 0) { |
|
259 | 259 |
cli_dbgmsg("cli_scandmg: Not blkx data element\n"); |
260 | 260 |
xmlFree(nodeName); |
261 | 261 |
continue; |
... | ... |
@@ -316,7 +316,7 @@ int cli_scandmg(cli_ctx *ctx) |
316 | 316 |
} |
317 | 317 |
if ((state == DMG_FIND_KEY_DATA) |
318 | 318 |
&& (depth > stateDepth[state-1]) |
319 |
- && (xmlStrcmp(nodeName, "key") == 0)) { |
|
319 |
+ && (xmlStrcmp(nodeName, (const xmlChar *)"key") == 0)) { |
|
320 | 320 |
xmlChar * textValue; |
321 | 321 |
dmg_parsemsg("read: Found key - checking for Data\n"); |
322 | 322 |
if (xmlTextReaderRead(reader) != 1) { |
... | ... |
@@ -334,7 +334,7 @@ int cli_scandmg(cli_ctx *ctx) |
334 | 334 |
xmlFree(nodeName); |
335 | 335 |
continue; |
336 | 336 |
} |
337 |
- if (xmlStrcmp(textValue, "Data") == 0) { |
|
337 |
+ if (xmlStrcmp(textValue, (const xmlChar *)"Data") == 0) { |
|
338 | 338 |
dmg_parsemsg("read: Matched data\n"); |
339 | 339 |
stateDepth[DMG_FIND_KEY_DATA] = depth; |
340 | 340 |
state++; |
... | ... |
@@ -346,12 +346,12 @@ int cli_scandmg(cli_ctx *ctx) |
346 | 346 |
} |
347 | 347 |
if ((state == DMG_FIND_BLKX_CONTAINER) |
348 | 348 |
&& (depth == stateDepth[state-1])) { |
349 |
- if (xmlStrcmp(nodeName, "array") == 0) { |
|
349 |
+ if (xmlStrcmp(nodeName, (const xmlChar *)"array") == 0) { |
|
350 | 350 |
dmg_parsemsg("read: Found array blkx\n"); |
351 | 351 |
stateDepth[DMG_FIND_BLKX_CONTAINER] = depth; |
352 | 352 |
state++; |
353 | 353 |
} |
354 |
- else if (xmlStrcmp(nodeName, "dict") == 0) { |
|
354 |
+ else if (xmlStrcmp(nodeName, (const xmlChar *)"dict") == 0) { |
|
355 | 355 |
dmg_parsemsg("read: Found dict blkx\n"); |
356 | 356 |
stateDepth[DMG_FIND_BLKX_CONTAINER] = depth; |
357 | 357 |
state++; |
... | ... |
@@ -364,7 +364,7 @@ int cli_scandmg(cli_ctx *ctx) |
364 | 364 |
} |
365 | 365 |
if ((state == DMG_FIND_KEY_BLKX) |
366 | 366 |
&& (depth == stateDepth[state-1] + 1) |
367 |
- && (xmlStrcmp(nodeName, "key") == 0)) { |
|
367 |
+ && (xmlStrcmp(nodeName, (const xmlChar *)"key") == 0)) { |
|
368 | 368 |
xmlChar * textValue; |
369 | 369 |
dmg_parsemsg("read: Found key - checking for blkx\n"); |
370 | 370 |
if (xmlTextReaderRead(reader) != 1) { |
... | ... |
@@ -382,7 +382,7 @@ int cli_scandmg(cli_ctx *ctx) |
382 | 382 |
xmlFree(nodeName); |
383 | 383 |
continue; |
384 | 384 |
} |
385 |
- if (xmlStrcmp(textValue, "blkx") == 0) { |
|
385 |
+ if (xmlStrcmp(textValue, (const xmlChar *)"blkx") == 0) { |
|
386 | 386 |
cli_dbgmsg("cli_scandmg: Matched blkx\n"); |
387 | 387 |
stateDepth[DMG_FIND_KEY_BLKX] = depth; |
388 | 388 |
state++; |
... | ... |
@@ -394,7 +394,7 @@ int cli_scandmg(cli_ctx *ctx) |
394 | 394 |
} |
395 | 395 |
if ((state == DMG_FIND_DICT_RESOURCE_FORK) |
396 | 396 |
&& (depth == stateDepth[state-1])) { |
397 |
- if (xmlStrcmp(nodeName, "dict") == 0) { |
|
397 |
+ if (xmlStrcmp(nodeName, (const xmlChar *)"dict") == 0) { |
|
398 | 398 |
dmg_parsemsg("read: Found resource-fork dict\n"); |
399 | 399 |
stateDepth[DMG_FIND_DICT_RESOURCE_FORK] = depth; |
400 | 400 |
state++; |
... | ... |
@@ -407,19 +407,19 @@ int cli_scandmg(cli_ctx *ctx) |
407 | 407 |
} |
408 | 408 |
if ((state == DMG_FIND_KEY_RESOURCE_FORK) |
409 | 409 |
&& (depth == stateDepth[state-1] + 1) |
410 |
- && (xmlStrcmp(nodeName, "key") == 0)) { |
|
410 |
+ && (xmlStrcmp(nodeName, (const xmlChar *)"key") == 0)) { |
|
411 | 411 |
dmg_parsemsg("read: Found resource-fork key\n"); |
412 | 412 |
stateDepth[DMG_FIND_KEY_RESOURCE_FORK] = depth; |
413 | 413 |
state++; |
414 | 414 |
} |
415 | 415 |
if ((state == DMG_FIND_BASE_DICT) |
416 | 416 |
&& (depth == stateDepth[state-1] + 1) |
417 |
- && (xmlStrcmp(nodeName, "dict") == 0)) { |
|
417 |
+ && (xmlStrcmp(nodeName, (const xmlChar *)"dict") == 0)) { |
|
418 | 418 |
dmg_parsemsg("read: Found dict start\n"); |
419 | 419 |
stateDepth[DMG_FIND_BASE_DICT] = depth; |
420 | 420 |
state++; |
421 | 421 |
} |
422 |
- if ((state == DMG_FIND_BASE_PLIST) && (xmlStrcmp(nodeName, "plist") == 0)) { |
|
422 |
+ if ((state == DMG_FIND_BASE_PLIST) && (xmlStrcmp(nodeName, (const xmlChar *)"plist") == 0)) { |
|
423 | 423 |
dmg_parsemsg("read: Found plist start\n"); |
424 | 424 |
stateDepth[DMG_FIND_BASE_PLIST] = depth; |
425 | 425 |
state++; |
... | ... |
@@ -498,13 +498,14 @@ int cli_scandmg(cli_ctx *ctx) |
498 | 498 |
static int dmg_decode_mish(cli_ctx *ctx, unsigned int *mishblocknum, xmlChar *mish_base64, |
499 | 499 |
struct dmg_mish_with_stripes *mish_set) |
500 | 500 |
{ |
501 |
- int ret = CL_CLEAN; |
|
502 | 501 |
size_t base64_len, buff_size, decoded_len; |
503 | 502 |
uint8_t *decoded; |
504 | 503 |
const uint8_t mish_magic[4] = { 0x6d, 0x69, 0x73, 0x68 }; |
505 | 504 |
|
505 |
+ UNUSEDPARAM(ctx); |
|
506 |
+ |
|
506 | 507 |
(*mishblocknum)++; |
507 |
- base64_len = strlen(mish_base64); |
|
508 |
+ base64_len = strlen((const char *)mish_base64); |
|
508 | 509 |
dmg_parsemsg("dmg_decode_mish: len of encoded block %u is %lu\n", *mishblocknum, base64_len); |
509 | 510 |
|
510 | 511 |
/* speed vs memory, could walk the encoded data and skip whitespace in calculation */ |
... | ... |
@@ -652,6 +653,8 @@ static int dmg_stripe_zeroes(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mi |
652 | 652 |
ssize_t written; |
653 | 653 |
uint8_t obuf[BUFSIZ]; |
654 | 654 |
|
655 |
+ UNUSEDPARAM(ctx); |
|
656 |
+ |
|
655 | 657 |
cli_dbgmsg("dmg_stripe_zeroes: stripe " STDu32 "\n", index); |
656 | 658 |
if (len == 0) |
657 | 659 |
return CL_CLEAN; |
... | ... |
@@ -659,7 +662,7 @@ static int dmg_stripe_zeroes(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mi |
659 | 659 |
memset(obuf, 0, sizeof(obuf)); |
660 | 660 |
while (len > sizeof(obuf)) { |
661 | 661 |
written = cli_writen(fd, obuf, sizeof(obuf)); |
662 |
- if (written != sizeof(obuf)) { |
|
662 |
+ if ((size_t)written != sizeof(obuf)) { |
|
663 | 663 |
ret = CL_EWRITE; |
664 | 664 |
break; |
665 | 665 |
} |
... | ... |
@@ -668,7 +671,7 @@ static int dmg_stripe_zeroes(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mi |
668 | 668 |
|
669 | 669 |
if ((ret == CL_CLEAN) && (len > 0)) { |
670 | 670 |
written = cli_writen(fd, obuf, len); |
671 |
- if (written != len) { |
|
671 |
+ if ((size_t)written != len) { |
|
672 | 672 |
ret = CL_EWRITE; |
673 | 673 |
} |
674 | 674 |
} |
... | ... |
@@ -684,7 +687,6 @@ static int dmg_stripe_zeroes(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mi |
684 | 684 |
static int dmg_stripe_store(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mish_with_stripes *mish_set) |
685 | 685 |
{ |
686 | 686 |
const void *obuf; |
687 |
- int ret; |
|
688 | 687 |
size_t off = mish_set->stripes[index].dataOffset; |
689 | 688 |
size_t len = mish_set->stripes[index].dataLength; |
690 | 689 |
ssize_t written; |
... | ... |
@@ -703,7 +705,7 @@ static int dmg_stripe_store(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mis |
703 | 703 |
cli_errmsg("dmg_stripe_store: error writing bytes to file (out of disk space?)\n"); |
704 | 704 |
return CL_EWRITE; |
705 | 705 |
} |
706 |
- else if (written != len) { |
|
706 |
+ else if ((size_t)written != len) { |
|
707 | 707 |
cli_errmsg("dmg_stripe_store: error writing bytes to file (out of disk space?)\n"); |
708 | 708 |
return CL_EWRITE; |
709 | 709 |
} |
... | ... |
@@ -713,7 +715,7 @@ static int dmg_stripe_store(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mis |
713 | 713 |
/* Stripe handling: ADC block (type 0x80000004) */ |
714 | 714 |
static int dmg_stripe_adc(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mish_with_stripes *mish_set) |
715 | 715 |
{ |
716 |
- int ret = CL_CLEAN, adcret; |
|
716 |
+ int adcret; |
|
717 | 717 |
adc_stream strm; |
718 | 718 |
size_t off = mish_set->stripes[index].dataOffset; |
719 | 719 |
size_t len = mish_set->stripes[index].dataLength; |
... | ... |
@@ -796,7 +798,7 @@ static int dmg_stripe_adc(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mish_ |
796 | 796 |
/* Stripe handling: deflate block (type 0x80000005) */ |
797 | 797 |
static int dmg_stripe_inflate(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mish_with_stripes *mish_set) |
798 | 798 |
{ |
799 |
- int ret = CL_CLEAN, zstat; |
|
799 |
+ int zstat; |
|
800 | 800 |
z_stream strm; |
801 | 801 |
size_t off = mish_set->stripes[index].dataOffset; |
802 | 802 |
size_t len = mish_set->stripes[index].dataLength; |
... | ... |
@@ -905,7 +907,7 @@ static int dmg_stripe_bzip(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mish |
905 | 905 |
|
906 | 906 |
#if HAVE_BZLIB_H |
907 | 907 |
memset(&strm, 0, sizeof(strm)); |
908 |
- strm.next_out = obuf; |
|
908 |
+ strm.next_out = (char *)obuf; |
|
909 | 909 |
strm.avail_out = sizeof(obuf); |
910 | 910 |
if (BZ2_bzDecompressInit(&strm, 0, 0) != BZ_OK) { |
911 | 911 |
cli_dbgmsg("dmg_stripe_bzip: bzDecompressInit failed\n"); |
... | ... |
@@ -960,13 +962,13 @@ static int dmg_stripe_bzip(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mish |
960 | 960 |
break; |
961 | 961 |
} |
962 | 962 |
|
963 |
- if (cli_writen(fd, obuf, next_write) != next_write) { |
|
963 |
+ if ((size_t)cli_writen(fd, obuf, next_write) != next_write) { |
|
964 | 964 |
cli_dbgmsg("dmg_stripe_bzip: error writing to tmpfile\n"); |
965 | 965 |
ret = CL_EWRITE; |
966 | 966 |
break; |
967 | 967 |
} |
968 | 968 |
|
969 |
- strm.next_out = obuf; |
|
969 |
+ strm.next_out = (char *)obuf; |
|
970 | 970 |
strm.avail_out = sizeof(obuf); |
971 | 971 |
|
972 | 972 |
if (rc == BZ_OK) |
... | ... |
@@ -989,13 +991,13 @@ static int dmg_stripe_bzip(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mish |
989 | 989 |
break; |
990 | 990 |
} |
991 | 991 |
|
992 |
- if (cli_writen(fd, obuf, next_write) != next_write) { |
|
992 |
+ if ((size_t)cli_writen(fd, obuf, next_write) != next_write) { |
|
993 | 993 |
cli_dbgmsg("dmg_stripe_bzip: error writing to tmpfile\n"); |
994 | 994 |
ret = CL_EWRITE; |
995 | 995 |
break; |
996 | 996 |
} |
997 | 997 |
|
998 |
- strm.next_out = obuf; |
|
998 |
+ strm.next_out = (char *)obuf; |
|
999 | 999 |
strm.avail_out = sizeof(obuf); |
1000 | 1000 |
} |
1001 | 1001 |
} while ((rc == BZ_OK) && (len > 0)); |
... | ... |
@@ -1154,7 +1156,7 @@ static int dmg_extract_xml(cli_ctx *ctx, char *dir, struct dmg_koly_block *hdr) |
1154 | 1154 |
return CL_ETMPFILE; |
1155 | 1155 |
} |
1156 | 1156 |
|
1157 |
- if (cli_writen(ofd, outdata, hdr->xmlLength) != hdr->xmlLength) { |
|
1157 |
+ if ((uint64_t)cli_writen(ofd, outdata, hdr->xmlLength) != hdr->xmlLength) { |
|
1158 | 1158 |
cli_errmsg("cli_scandmg: Not all bytes written!\n"); |
1159 | 1159 |
close(ofd); |
1160 | 1160 |
free(xmlfile); |
... | ... |
@@ -815,11 +815,7 @@ int cli_scanelf(cli_ctx *ctx) |
815 | 815 |
int cli_elfheader(fmap_t *map, struct cli_exe_info *elfinfo) |
816 | 816 |
{ |
817 | 817 |
union elf_file_hdr file_hdr; |
818 |
- struct elf_section_hdr32 *section_hdr = NULL; |
|
819 |
- struct elf_program_hdr32 *program_hdr = NULL; |
|
820 |
- uint16_t shnum, phnum, shentsize, phentsize, i; |
|
821 |
- uint64_t entry, fentry = 0, shoff, phoff; |
|
822 |
- uint8_t conv = 0, err, is64 = 0; |
|
818 |
+ uint8_t conv = 0, is64 = 0; |
|
823 | 819 |
int ret; |
824 | 820 |
|
825 | 821 |
cli_dbgmsg("in cli_elfheader\n"); |
... | ... |
@@ -711,7 +711,6 @@ static int in_iconv_u16(const m_area_t* in_m_area, iconv_t* iconv_struct, m_area |
711 | 711 |
char* input = (char*)in_m_area->buffer + in_m_area->offset; |
712 | 712 |
size_t outleft = out_m_area->length > 0 ? out_m_area->length : 0; |
713 | 713 |
char* out = (char*)out_m_area->buffer; |
714 |
- char err[128]; |
|
715 | 714 |
|
716 | 715 |
out_m_area->offset = 0; |
717 | 716 |
if(!inleft) { |
... | ... |
@@ -734,7 +733,7 @@ static int in_iconv_u16(const m_area_t* in_m_area, iconv_t* iconv_struct, m_area |
734 | 734 |
while (inleft && (outleft >= 2)) { /* iconv doesn't like inleft to be 0 */ |
735 | 735 |
const size_t outleft_last = outleft; |
736 | 736 |
assert(*iconv_struct != (iconv_t)-1); |
737 |
- rc = iconv(*iconv_struct, &input, &inleft, &out, &outleft); |
|
737 |
+ rc = iconv(*iconv_struct, (const char **)(&input), &inleft, &out, &outleft); |
|
738 | 738 |
if(rc == (size_t)-1) { |
739 | 739 |
if(errno == E2BIG) { |
740 | 740 |
/* not enough space in output buffer */ |
... | ... |
@@ -120,6 +120,8 @@ static const struct ftmap_s { |
120 | 120 |
{ NULL, CL_TYPE_IGNORED } |
121 | 121 |
}; |
122 | 122 |
|
123 |
+cli_file_t cli_partitiontype(const unsigned char *buf, size_t buflen, const struct cl_engine *engine); |
|
124 |
+ |
|
123 | 125 |
cli_file_t cli_ftcode(const char *name) |
124 | 126 |
{ |
125 | 127 |
unsigned int i; |
... | ... |
@@ -266,7 +268,7 @@ cli_file_t cli_filetype2(fmap_t *map, const struct cl_engine *engine, cli_file_t |
266 | 266 |
int zi; |
267 | 267 |
|
268 | 268 |
for (zi=0; zi<32; zi++) { |
269 |
- znamep = cli_memstr(znamep, zlen, lhdr_magic, 4); |
|
269 |
+ znamep = (const unsigned char *)cli_memstr((const char *)znamep, zlen, lhdr_magic, 4); |
|
270 | 270 |
if (NULL != znamep) { |
271 | 271 |
znamep += SIZEOF_LH; |
272 | 272 |
zlen = zread - (znamep - zbuff); |
... | ... |
@@ -190,6 +190,8 @@ int filter_add_static(struct filter *m, const unsigned char *pattern, unsigned l |
190 | 190 |
uint32_t best = 0xffffffff; |
191 | 191 |
uint8_t best_pos = 0; |
192 | 192 |
|
193 |
+ UNUSEDPARAM(name); |
|
194 |
+ |
|
193 | 195 |
cli_perf_log_count(TRIE_ORIG_LEN, len > 8 ? 8 : len); |
194 | 196 |
/* TODO: choose best among MAXCHOICES */ |
195 | 197 |
/* cut length */ |
... | ... |
@@ -282,15 +284,6 @@ static inline unsigned char spec_ith_char(const struct char_spec *spec, unsigned |
282 | 282 |
return i; |
283 | 283 |
} |
284 | 284 |
|
285 |
-static const struct char_spec full_range = {NULL, 0,0xff,1,0}; |
|
286 |
- |
|
287 |
-static inline int spec_is_fullrange(const struct char_spec *spec0, const struct char_spec *spec1) |
|
288 |
-{ |
|
289 |
- return !memcmp(spec0, &full_range, sizeof(full_range)) && |
|
290 |
- !memcmp(spec1, &full_range, sizeof(full_range)); |
|
291 |
-} |
|
292 |
- |
|
293 |
- |
|
294 | 285 |
#ifndef MIN |
295 | 286 |
#define MIN(a,b) ((a) < (b) ? (a) : (b)) |
296 | 287 |
#endif |
... | ... |
@@ -696,43 +689,6 @@ int filter_add_acpatt(struct filter *m, const struct cli_ac_patt *pat) |
696 | 696 |
return j+2; |
697 | 697 |
} |
698 | 698 |
|
699 |
-static const struct match_len_info { |
|
700 |
- uint8_t shortest; |
|
701 |
- uint8_t longest; |
|
702 |
-} match_len[256] = { |
|
703 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{5,9}, |
|
704 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{6,9}, |
|
705 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{5,9}, |
|
706 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{7,9}, |
|
707 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{5,9}, |
|
708 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{6,9}, |
|
709 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{5,9}, |
|
710 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{8,9}, |
|
711 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{5,9}, |
|
712 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{6,9}, |
|
713 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{5,9}, |
|
714 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{7,9}, |
|
715 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{5,9}, |
|
716 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{6,9}, |
|
717 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{5,9}, |
|
718 |
- {2,9},{3,9},{2,9},{4,9},{2,9},{3,9},{2,9},{9,9}, |
|
719 |
- {2,8},{3,8},{2,8},{4,8},{2,8},{3,8},{2,8},{5,8}, |
|
720 |
- {2,8},{3,8},{2,8},{4,8},{2,8},{3,8},{2,8},{6,8}, |
|
721 |
- {2,8},{3,8},{2,8},{4,8},{2,8},{3,8},{2,8},{5,8}, |
|
722 |
- {2,8},{3,8},{2,8},{4,8},{2,8},{3,8},{2,8},{7,8}, |
|
723 |
- {2,8},{3,8},{2,8},{4,8},{2,8},{3,8},{2,8},{5,8}, |
|
724 |
- {2,8},{3,8},{2,8},{4,8},{2,8},{3,8},{2,8},{6,8}, |
|
725 |
- {2,8},{3,8},{2,8},{4,8},{2,8},{3,8},{2,8},{5,8}, |
|
726 |
- {2,8},{3,8},{2,8},{4,8},{2,8},{3,8},{2,8},{8,8}, |
|
727 |
- {2,7},{3,7},{2,7},{4,7},{2,7},{3,7},{2,7},{5,7}, |
|
728 |
- {2,7},{3,7},{2,7},{4,7},{2,7},{3,7},{2,7},{6,7}, |
|
729 |
- {2,7},{3,7},{2,7},{4,7},{2,7},{3,7},{2,7},{5,7}, |
|
730 |
- {2,7},{3,7},{2,7},{4,7},{2,7},{3,7},{2,7},{7,7}, |
|
731 |
- {2,6},{3,6},{2,6},{4,6},{2,6},{3,6},{2,6},{5,6}, |
|
732 |
- {2,6},{3,6},{2,6},{4,6},{2,6},{3,6},{2,6},{6,6}, |
|
733 |
- {2,5},{3,5},{2,5},{4,5},{2,5},{3,5},{2,5},{5,5}, |
|
734 |
- {2,4},{3,4},{2,4},{4,4},{2,3},{3,3},{2,2},{0,0} |
|
735 |
-}; |
|
736 | 699 |
/* state 11110011 means that we may have a match of length min 4, max 5 */ |
737 | 700 |
|
738 | 701 |
__hot__ int filter_search_ext(const struct filter *m, const unsigned char *data, unsigned long len, struct filter_match_info *inf) |
... | ... |
@@ -62,12 +62,8 @@ static off_t pread_cb(void *handle, void *buf, size_t count, off_t offset) |
62 | 62 |
|
63 | 63 |
|
64 | 64 |
fmap_t *fmap_check_empty(int fd, off_t offset, size_t len, int *empty) { |
65 |
- unsigned int pages, mapsz, hdrsz; |
|
66 |
- unsigned short dumb = 1; |
|
67 |
- int pgsz = cli_getpagesize(); |
|
68 | 65 |
STATBUF st; |
69 | 66 |
fmap_t *m; |
70 |
- void *handle = (void*)(ssize_t)fd; |
|
71 | 67 |
|
72 | 68 |
*empty = 0; |
73 | 69 |
if(FSTAT(fd, &st)) { |
... | ... |
@@ -215,7 +211,7 @@ extern cl_fmap_t *cl_fmap_open_handle(void *handle, size_t offset, size_t len, |
215 | 215 |
cl_fmap_t *m; |
216 | 216 |
int pgsz = cli_getpagesize(); |
217 | 217 |
|
218 |
- if(offset < 0 || offset != fmap_align_to(offset, pgsz)) { |
|
218 |
+ if((off_t)offset < 0 || offset != fmap_align_to(offset, pgsz)) { |
|
219 | 219 |
cli_warnmsg("fmap: attempted mapping with unaligned offset\n"); |
220 | 220 |
return NULL; |
221 | 221 |
} |
... | ... |
@@ -651,8 +647,6 @@ static void mem_unneed_off(fmap_t *m, size_t at, size_t len); |
651 | 651 |
static const void *mem_need_offstr(fmap_t *m, size_t at, size_t len_hint); |
652 | 652 |
static const void *mem_gets(fmap_t *m, char *dst, size_t *at, size_t max_len); |
653 | 653 |
|
654 |
-static void unmap_none(fmap_t *m) {} |
|
655 |
- |
|
656 | 654 |
extern cl_fmap_t *cl_fmap_open_memory(const void *start, size_t len) |
657 | 655 |
{ |
658 | 656 |
int pgsz = cli_getpagesize(); |
... | ... |
@@ -676,6 +670,7 @@ extern cl_fmap_t *cl_fmap_open_memory(const void *start, size_t len) |
676 | 676 |
|
677 | 677 |
|
678 | 678 |
static const void *mem_need(fmap_t *m, size_t at, size_t len, int lock) { /* WIN32 */ |
679 |
+ UNUSEDPARAM(lock); |
|
679 | 680 |
if(!len) { |
680 | 681 |
return NULL; |
681 | 682 |
} |
... | ... |
@@ -687,7 +682,12 @@ static const void *mem_need(fmap_t *m, size_t at, size_t len, int lock) { /* WIN |
687 | 687 |
return (void *)((char *)m->data + at); |
688 | 688 |
} |
689 | 689 |
|
690 |
-static void mem_unneed_off(fmap_t *m, size_t at, size_t len) {} |
|
690 |
+static void mem_unneed_off(fmap_t *m, size_t at, size_t len) |
|
691 |
+{ |
|
692 |
+ UNUSEDPARAM(m); |
|
693 |
+ UNUSEDPARAM(at); |
|
694 |
+ UNUSEDPARAM(len); |
|
695 |
+} |
|
691 | 696 |
|
692 | 697 |
static const void *mem_need_offstr(fmap_t *m, size_t at, size_t len_hint) { |
693 | 698 |
char *ptr = (char *)m->data + at; |
... | ... |
@@ -759,7 +759,7 @@ int fmap_dump_to_file(fmap_t *map, const char *tmpdir, char **outname, int *outf |
759 | 759 |
b = fmap_need_off_once_len(map, pos, BUFSIZ, &len); |
760 | 760 |
pos += len; |
761 | 761 |
if(b && (len > 0)) { |
762 |
- if (cli_writen(tmpfd, b, len) != len) { |
|
762 |
+ if ((size_t)cli_writen(tmpfd, b, len) != len) { |
|
763 | 763 |
cli_warnmsg("fmap_dump_to_file: write failed to %s!\n", tmpname); |
764 | 764 |
close(tmpfd); |
765 | 765 |
unlink(tmpname); |
... | ... |
@@ -780,7 +780,7 @@ int fmap_dump_to_file(fmap_t *map, const char *tmpdir, char **outname, int *outf |
780 | 780 |
|
781 | 781 |
int fmap_fd(fmap_t *m) |
782 | 782 |
{ |
783 |
- int fd, ret; |
|
783 |
+ int fd; |
|
784 | 784 |
if (!m->handle_is_fd) |
785 | 785 |
return -1; |
786 | 786 |
fd = (int)(ssize_t)m->handle; |
... | ... |
@@ -78,22 +78,22 @@ size_t gpt_detect_size(fmap_t *map) |
78 | 78 |
|
79 | 79 |
buff = (unsigned char*)fmap_need_off_once(map, 512, 8); |
80 | 80 |
if (!buff) return 0; |
81 |
- if (0 == strncmp(buff, GPT_SIGNATURE_STR, 8)) |
|
81 |
+ if (0 == strncmp((const char *)buff, GPT_SIGNATURE_STR, 8)) |
|
82 | 82 |
return 512; |
83 | 83 |
|
84 | 84 |
buff = (unsigned char*)fmap_need_off_once(map, 1024, 8); |
85 | 85 |
if (!buff) return 0; |
86 |
- if (0 == strncmp(buff, GPT_SIGNATURE_STR, 8)) |
|
86 |
+ if (0 == strncmp((const char *)buff, GPT_SIGNATURE_STR, 8)) |
|
87 | 87 |
return 1024; |
88 | 88 |
|
89 | 89 |
buff = (unsigned char*)fmap_need_off_once(map, 2048, 8); |
90 | 90 |
if (!buff) return 0; |
91 |
- if (0 == strncmp(buff, GPT_SIGNATURE_STR, 8)) |
|
91 |
+ if (0 == strncmp((const char *)buff, GPT_SIGNATURE_STR, 8)) |
|
92 | 92 |
return 2048; |
93 | 93 |
|
94 | 94 |
buff = (unsigned char*)fmap_need_off_once(map, 4096, 8); |
95 | 95 |
if (!buff) return 0; |
96 |
- if (0 == strncmp(buff, GPT_SIGNATURE_STR, 8)) |
|
96 |
+ if (0 == strncmp((const char *)buff, GPT_SIGNATURE_STR, 8)) |
|
97 | 97 |
return 4096; |
98 | 98 |
|
99 | 99 |
return 0; |
... | ... |
@@ -571,6 +571,8 @@ static void gpt_printSectors(cli_ctx *ctx, size_t sectorsize) |
571 | 571 |
gpt_parsemsg("%llu-%llu: Secondary GPT Partition Table\n", shdr.tableStartLBA, stableLastLBA); |
572 | 572 |
gpt_parsemsg("%llu: Secondary GPT Header\n", phdr.backupLBA); |
573 | 573 |
#else |
574 |
+ UNUSEDPARAM(ctx); |
|
575 |
+ UNUSEDPARAM(sectorsize); |
|
574 | 576 |
return; |
575 | 577 |
#endif |
576 | 578 |
} |
... | ... |
@@ -931,7 +931,7 @@ int cli_map_removekey(struct cli_map *m, const void *key, int32_t keysize) |
931 | 931 |
int cli_map_setvalue(struct cli_map *m, const void* value, int32_t valuesize) |
932 | 932 |
{ |
933 | 933 |
if ((m->valuesize && m->valuesize != valuesize) |
934 |
- || m->last_insert >= m->nvalues || m->last_insert < 0) |
|
934 |
+ || (uint32_t)(m->last_insert) >= m->nvalues || m->last_insert < 0) |
|
935 | 935 |
return -CL_EARG; |
936 | 936 |
if (m->valuesize) { |
937 | 937 |
memcpy((char*)m->u.sized_values + m->last_insert * m->valuesize, |
... | ... |
@@ -967,14 +967,14 @@ int cli_map_getvalue_size(struct cli_map *m) |
967 | 967 |
{ |
968 | 968 |
if (m->valuesize) |
969 | 969 |
return m->valuesize; |
970 |
- if (m->last_find < 0 || m->last_find >= m->nvalues) |
|
970 |
+ if (m->last_find < 0 || (uint32_t)(m->last_find) >= m->nvalues) |
|
971 | 971 |
return -CL_EARG; |
972 | 972 |
return m->u.unsized_values[m->last_find].valuesize; |
973 | 973 |
} |
974 | 974 |
|
975 | 975 |
void* cli_map_getvalue(struct cli_map *m) |
976 | 976 |
{ |
977 |
- if (m->last_find < 0 || m->last_find >= m->nvalues) |
|
977 |
+ if (m->last_find < 0 || (uint32_t)(m->last_find) >= m->nvalues) |
|
978 | 978 |
return NULL; |
979 | 979 |
if (m->valuesize) |
980 | 980 |
return (char*)m->u.sized_values + m->last_find*m->valuesize; |
... | ... |
@@ -300,6 +300,8 @@ static int hfsplus_scanfile(cli_ctx *ctx, hfsPlusVolumeHeader *volHeader, hfsHea |
300 | 300 |
uint32_t outputBlocks = 0; |
301 | 301 |
uint8_t ext; |
302 | 302 |
|
303 |
+ UNUSEDPARAM(extHeader); |
|
304 |
+ |
|
303 | 305 |
/* bad record checks */ |
304 | 306 |
if (!fork || (fork->logicalSize == 0) || (fork->totalBlocks == 0)) { |
305 | 307 |
cli_dbgmsg("hfsplus_dumpfile: Empty file.\n"); |
... | ... |
@@ -381,7 +383,7 @@ static int hfsplus_scanfile(cli_ctx *ctx, hfsPlusVolumeHeader *volHeader, hfsHea |
381 | 381 |
break; |
382 | 382 |
} |
383 | 383 |
written = cli_writen(ofd, mPtr, to_write); |
384 |
- if (written != to_write) { |
|
384 |
+ if ((size_t)written != to_write) { |
|
385 | 385 |
cli_errmsg("hfsplus_dumpfile: write error\n"); |
386 | 386 |
ret = CL_EWRITE; |
387 | 387 |
break; |
... | ... |
@@ -425,6 +427,8 @@ static int hfsplus_validate_catalog(cli_ctx *ctx, hfsPlusVolumeHeader *volHeader |
425 | 425 |
{ |
426 | 426 |
hfsPlusForkData *catFork; |
427 | 427 |
|
428 |
+ UNUSEDPARAM(ctx); |
|
429 |
+ |
|
428 | 430 |
catFork = &(volHeader->catalogFile); |
429 | 431 |
if (catFork->totalBlocks >= volHeader->totalBlocks) { |
430 | 432 |
cli_dbgmsg("hfsplus_getnodelimit: catFork totalBlocks too large!\n"); |
... | ... |
@@ -446,13 +450,15 @@ static int hfsplus_validate_catalog(cli_ctx *ctx, hfsPlusVolumeHeader *volHeader |
446 | 446 |
static int hfsplus_fetch_node (cli_ctx *ctx, hfsPlusVolumeHeader *volHeader, hfsHeaderRecord *catHeader, |
447 | 447 |
hfsHeaderRecord *extHeader, uint32_t node, uint8_t *buff) |
448 | 448 |
{ |
449 |
- int foundBlock = 0, ret = CL_CLEAN; |
|
449 |
+ int foundBlock = 0; |
|
450 | 450 |
uint64_t catalogOffset; |
451 | 451 |
uint32_t fetchBlock, fetchStart; |
452 | 452 |
uint32_t extentNum = 0, realFileBlock; |
453 | 453 |
size_t fileOffset = 0; |
454 | 454 |
hfsPlusForkData *catFork; |
455 | 455 |
|
456 |
+ UNUSEDPARAM(extHeader); |
|
457 |
+ |
|
456 | 458 |
/* Make sure node is in range */ |
457 | 459 |
if (node >= catHeader->totalNodes) { |
458 | 460 |
cli_dbgmsg("hfsplus_fetch_node: invalid node number " STDu32 "\n", node); |
... | ... |
@@ -535,15 +541,6 @@ static int hfsplus_fetch_node (cli_ctx *ctx, hfsPlusVolumeHeader *volHeader, hfs |
535 | 535 |
} |
536 | 536 |
|
537 | 537 |
/* Given the catalog and other details, scan all the volume contents */ |
538 |
-static int hfsplus_scan_node(cli_ctx *ctx, hfsPlusVolumeHeader *volHeader, hfsHeaderRecord *catHeader, |
|
539 |
- hfsHeaderRecord *extHeader, const char *dirname, uint8_t *nodeBuf) |
|
540 |
-{ |
|
541 |
- int ret = CL_CLEAN; |
|
542 |
- |
|
543 |
- return ret; |
|
544 |
-} |
|
545 |
- |
|
546 |
-/* Given the catalog and other details, scan all the volume contents */ |
|
547 | 538 |
static int hfsplus_walk_catalog(cli_ctx *ctx, hfsPlusVolumeHeader *volHeader, hfsHeaderRecord *catHeader, |
548 | 539 |
hfsHeaderRecord *extHeader, const char *dirname) |
549 | 540 |
{ |
... | ... |
@@ -62,6 +62,8 @@ |
62 | 62 |
#include "hostid.h" |
63 | 63 |
#include "libclamav/others.h" |
64 | 64 |
|
65 |
+struct device *get_device_entry(struct device *devices, size_t *ndevices, const char *name); |
|
66 |
+ |
|
65 | 67 |
struct device *get_device_entry(struct device *devices, size_t *ndevices, const char *name) |
66 | 68 |
{ |
67 | 69 |
void *p; |
... | ... |
@@ -256,7 +256,7 @@ int cli_scanishield_msi(cli_ctx *ctx, off_t off) { |
256 | 256 |
while(csize) { |
257 | 257 |
uint8_t buf2[BUFSIZ]; |
258 | 258 |
z.avail_in = MIN(csize, sizeof(buf2)); |
259 |
- if(fmap_readn(map, buf2, off, z.avail_in) != z.avail_in) { |
|
259 |
+ if((uInt)fmap_readn(map, buf2, off, z.avail_in) != z.avail_in) { |
|
260 | 260 |
cli_dbgmsg("ishield-msi: premature EOS or read fail\n"); |
261 | 261 |
break; |
262 | 262 |
} |
... | ... |
@@ -373,7 +373,7 @@ int cli_scanishield(cli_ctx *ctx, off_t off, size_t sz) { |
373 | 373 |
if(fsize < 0 || fsize == LONG_MAX || |
374 | 374 |
!*strsz || !eostr || eostr == strsz || *eostr || |
375 | 375 |
(unsigned long)fsize >= sz || |
376 |
- data - fname >= sz - fsize |
|
376 |
+ (size_t)(data - fname) >= sz - fsize |
|
377 | 377 |
) break; |
378 | 378 |
|
379 | 379 |
cli_dbgmsg("ishield: @%lx found file %s (%s) - version %s - size %lu\n", (unsigned long int) coff, fname, path, version, (unsigned long int) fsize); |
... | ... |
@@ -70,7 +70,7 @@ static int iso_scan_file(const iso9660_t *iso, unsigned int block, unsigned int |
70 | 70 |
ret = CL_EFORMAT; |
71 | 71 |
break; |
72 | 72 |
} |
73 |
- if(cli_writen(fd, buf, todo) != todo) { |
|
73 |
+ if((unsigned int)cli_writen(fd, buf, todo) != todo) { |
|
74 | 74 |
cli_warnmsg("iso_scan_file: Can't write to file %s\n", tmpf); |
75 | 75 |
ret = CL_EWRITE; |
76 | 76 |
break; |
... | ... |
@@ -65,7 +65,7 @@ int json_object_object_get_ex(struct json_object *obj, const char *key, struct j |
65 | 65 |
#define nojson_func cli_dbgmsg |
66 | 66 |
|
67 | 67 |
/* internal functions */ |
68 |
-int cli_json_nojson(); |
|
68 |
+int cli_json_nojson(void); |
|
69 | 69 |
|
70 | 70 |
int cli_jsonnull_nojson(const char* key); |
71 | 71 |
int cli_jsonstr_nojson(const char* key, const char* s); |
... | ... |
@@ -28,9 +28,9 @@ |
28 | 28 |
#include "lzma_iface.h" |
29 | 29 |
|
30 | 30 |
void *__lzma_wrap_alloc(void *unused, size_t size) { |
31 |
+ UNUSEDPARAM(unused); |
|
31 | 32 |
if(!size || size > CLI_MAX_ALLOCATION) |
32 | 33 |
return NULL; |
33 |
- unused = unused; |
|
34 | 34 |
if(!size || size > CLI_MAX_ALLOCATION) { |
35 | 35 |
cli_dbgmsg("lzma_wrap_alloc(): Attempt to allocate %lu bytes.\n", (unsigned long int) size); |
36 | 36 |
return NULL; |
... | ... |
@@ -39,7 +39,7 @@ void *__lzma_wrap_alloc(void *unused, size_t size) { |
39 | 39 |
return cli_malloc(size); |
40 | 40 |
} |
41 | 41 |
void __lzma_wrap_free(void *unused, void *freeme) { |
42 |
- unused = unused; |
|
42 |
+ UNUSEDPARAM(unused); |
|
43 | 43 |
free(freeme); |
44 | 44 |
} |
45 | 45 |
static ISzAlloc g_Alloc = { __lzma_wrap_alloc, __lzma_wrap_free }; |
... | ... |
@@ -293,10 +293,8 @@ static int ac_maketrans(struct cli_matcher *root) |
293 | 293 |
{ |
294 | 294 |
struct bfs_list *bfs = NULL, *bfs_last = NULL; |
295 | 295 |
struct cli_ac_node *ac_root = root->ac_root, *child, *node, *fail; |
296 |
- struct cli_ac_patt *patt; |
|
297 | 296 |
int i, ret; |
298 | 297 |
|
299 |
- |
|
300 | 298 |
for(i = 0; i < 256; i++) { |
301 | 299 |
node = ac_root->trans[i]; |
302 | 300 |
if(!node) { |
... | ... |
@@ -911,6 +909,7 @@ int cli_ac_initdata(struct cli_ac_data *data, uint32_t partsigs, uint32_t lsigs, |
911 | 911 |
{ |
912 | 912 |
unsigned int i, j; |
913 | 913 |
|
914 |
+ UNUSEDPARAM(tracklen); |
|
914 | 915 |
|
915 | 916 |
if(!data) { |
916 | 917 |
cli_errmsg("cli_ac_init: data == NULL\n"); |
... | ... |
@@ -1360,7 +1359,7 @@ int cli_ac_scanbuff(const unsigned char *buffer, uint32_t length, const char **v |
1360 | 1360 |
if(res) { |
1361 | 1361 |
newres = (struct cli_ac_result *) malloc(sizeof(struct cli_ac_result)); |
1362 | 1362 |
if(!newres) { |
1363 |
- cli_errmsg("cli_ac_scanbuff: Can't allocate memory for newres %u\n", sizeof(struct cli_ac_result)); |
|
1363 |
+ cli_errmsg("cli_ac_scanbuff: Can't allocate memory for newres %lu\n", sizeof(struct cli_ac_result)); |
|
1364 | 1364 |
return CL_EMEM; |
1365 | 1365 |
} |
1366 | 1366 |
newres->virname = pt->virname; |
... | ... |
@@ -1413,7 +1412,7 @@ int cli_ac_scanbuff(const unsigned char *buffer, uint32_t length, const char **v |
1413 | 1413 |
if(res) { |
1414 | 1414 |
newres = (struct cli_ac_result *) malloc(sizeof(struct cli_ac_result)); |
1415 | 1415 |
if(!newres) { |
1416 |
- cli_errmsg("cli_ac_scanbuff: Can't allocate memory for newres %u\n", sizeof(struct cli_ac_result)); |
|
1416 |
+ cli_errmsg("cli_ac_scanbuff: Can't allocate memory for newres %lu\n", sizeof(struct cli_ac_result)); |
|
1417 | 1417 |
return CL_EMEM; |
1418 | 1418 |
} |
1419 | 1419 |
newres->virname = pt->virname; |
... | ... |
@@ -72,8 +72,19 @@ static inline int PERF_LOG_TRIES(int8_t acmode, int8_t bm_called, int32_t length |
72 | 72 |
} |
73 | 73 |
|
74 | 74 |
#else |
75 |
-static inline void PERF_LOG_FILTER(int32_t pos, uint32_t length, int8_t trie) {} |
|
76 |
-static inline int PERF_LOG_TRIES(int8_t acmode, int8_t bm_called, int32_t length) { return 0; } |
|
75 |
+static inline void PERF_LOG_FILTER(int32_t pos, uint32_t length, int8_t trie) { |
|
76 |
+ UNUSEDPARAM(pos); |
|
77 |
+ UNUSEDPARAM(length); |
|
78 |
+ UNUSEDPARAM(trie); |
|
79 |
+} |
|
80 |
+ |
|
81 |
+static inline int PERF_LOG_TRIES(int8_t acmode, int8_t bm_called, int32_t length) { |
|
82 |
+ UNUSEDPARAM(acmode); |
|
83 |
+ UNUSEDPARAM(bm_called); |
|
84 |
+ UNUSEDPARAM(length); |
|
85 |
+ |
|
86 |
+ return 0; |
|
87 |
+} |
|
77 | 88 |
#endif |
78 | 89 |
|
79 | 90 |
static inline int matcher_run(const struct cli_matcher *root, |
... | ... |
@@ -97,6 +108,8 @@ static inline int matcher_run(const struct cli_matcher *root, |
97 | 97 |
const unsigned char* orig_buffer; |
98 | 98 |
unsigned int viruses_found = 0; |
99 | 99 |
|
100 |
+ UNUSEDPARAM(map); |
|
101 |
+ |
|
100 | 102 |
if (root->filter) { |
101 | 103 |
if(filter_search_ext(root->filter, buffer, length, &info) == -1) { |
102 | 104 |
/* for safety always scan last maxpatlen bytes */ |
... | ... |
@@ -529,7 +542,7 @@ int cli_checkfp(unsigned char *digest, size_t size, cli_ctx *ctx) |
529 | 529 |
} |
530 | 530 |
|
531 | 531 |
if (ctx->engine->cb_hash) |
532 |
- ctx->engine->cb_hash(fmap_fd(*ctx->fmap), size, md5, cli_get_last_virus(ctx), ctx->cb_ctx); |
|
532 |
+ ctx->engine->cb_hash(fmap_fd(*ctx->fmap), size, (const unsigned char *)md5, cli_get_last_virus(ctx), ctx->cb_ctx); |
|
533 | 533 |
|
534 | 534 |
if (ctx->engine->cb_stats_add_sample) |
535 | 535 |
ctx->engine->cb_stats_add_sample(cli_get_last_virus(ctx), digest, size, §ions, ctx->engine->stats_data); |
... | ... |
@@ -925,11 +938,11 @@ int cli_fmap_scandesc(cli_ctx *ctx, cli_file_t ftype, uint8_t ftonly, struct cli |
925 | 925 |
uint32_t data_len = bytes - maxpatlen * (offset!=0); |
926 | 926 |
|
927 | 927 |
if(compute_hash[CLI_HASH_MD5]) |
928 |
- cl_update_hash(md5ctx, data, data_len); |
|
928 |
+ cl_update_hash(md5ctx, (void *)data, data_len); |
|
929 | 929 |
if(compute_hash[CLI_HASH_SHA1]) |
930 |
- cl_update_hash(sha1ctx, data, data_len); |
|
930 |
+ cl_update_hash(sha1ctx, (void *)data, data_len); |
|
931 | 931 |
if(compute_hash[CLI_HASH_SHA256]) |
932 |
- cl_update_hash(sha256ctx, data, data_len); |
|
932 |
+ cl_update_hash(sha256ctx, (void *)data, data_len); |
|
933 | 933 |
} |
934 | 934 |
} |
935 | 935 |
|
... | ... |
@@ -1023,7 +1036,7 @@ int cli_fmap_scandesc(cli_ctx *ctx, cli_file_t ftype, uint8_t ftonly, struct cli |
1023 | 1023 |
|
1024 | 1024 |
if(troot) { |
1025 | 1025 |
if(ret != CL_VIRUS || SCAN_ALL) |
1026 |
- ret = cli_lsig_eval(ctx, troot, &tdata, &info, refhash); |
|
1026 |
+ ret = cli_lsig_eval(ctx, troot, &tdata, &info, (const char *)refhash); |
|
1027 | 1027 |
if (ret == CL_VIRUS) |
1028 | 1028 |
viruses_found++; |
1029 | 1029 |
|
... | ... |
@@ -1034,7 +1047,7 @@ int cli_fmap_scandesc(cli_ctx *ctx, cli_file_t ftype, uint8_t ftonly, struct cli |
1034 | 1034 |
|
1035 | 1035 |
if(groot) { |
1036 | 1036 |
if(ret != CL_VIRUS || SCAN_ALL) |
1037 |
- ret = cli_lsig_eval(ctx, groot, &gdata, &info, refhash); |
|
1037 |
+ ret = cli_lsig_eval(ctx, groot, &gdata, &info, (const char *)refhash); |
|
1038 | 1038 |
cli_ac_freedata(&gdata); |
1039 | 1039 |
} |
1040 | 1040 |
|
... | ... |
@@ -18,8 +18,6 @@ |
18 | 18 |
* MA 02110-1301, USA. |
19 | 19 |
*/ |
20 | 20 |
|
21 |
-static char const rcsid[] = "$Id: mbox.c,v 1.381 2007/02/15 12:26:44 njh Exp $"; |
|
22 |
- |
|
23 | 21 |
#if HAVE_CONFIG_H |
24 | 22 |
#include "clamav-config.h" |
25 | 23 |
#endif |
... | ... |
@@ -2144,7 +2142,7 @@ boundaryStart(const char *line, const char *boundary) |
2144 | 2144 |
|
2145 | 2145 |
newline = strdup(line); |
2146 | 2146 |
if (!(newline)) |
2147 |
- newline = line; |
|
2147 |
+ newline = (char *)line; |
|
2148 | 2148 |
|
2149 | 2149 |
if (newline != line && strlen(newline)) { |
2150 | 2150 |
char *p; |
... | ... |
@@ -2266,7 +2264,8 @@ boundaryEnd(const char *line, const char *boundary) |
2266 | 2266 |
|
2267 | 2267 |
p = newline = strdup(line); |
2268 | 2268 |
if (!(newline)) { |
2269 |
- p = newline = line; |
|
2269 |
+ p = (char *)line; |
|
2270 |
+ newline = (char *)line; |
|
2270 | 2271 |
} |
2271 | 2272 |
|
2272 | 2273 |
if (newline != line && strlen(newline)) { |
... | ... |
@@ -2508,7 +2507,7 @@ parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const c |
2508 | 2508 |
|
2509 | 2509 |
buf = cli_malloc(strlen(ptr) + 1); |
2510 | 2510 |
if(buf == NULL) { |
2511 |
- cli_errmsg("parseMimeHeader: Unable to allocate memory for buf %u\n", strlen(ptr) + 1); |
|
2511 |
+ cli_errmsg("parseMimeHeader: Unable to allocate memory for buf %lu\n", strlen(ptr) + 1); |
|
2512 | 2512 |
if(copy) |
2513 | 2513 |
free(copy); |
2514 | 2514 |
return -1; |
... | ... |
@@ -2617,7 +2616,7 @@ parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const c |
2617 | 2617 |
case CONTENT_DISPOSITION: |
2618 | 2618 |
buf = cli_malloc(strlen(ptr) + 1); |
2619 | 2619 |
if(buf == NULL) { |
2620 |
- cli_errmsg("parseMimeHeader: Unable to allocate memory for buf %u\n", strlen(ptr) + 1); |
|
2620 |
+ cli_errmsg("parseMimeHeader: Unable to allocate memory for buf %lu\n", strlen(ptr) + 1); |
|
2621 | 2621 |
if(copy) |
2622 | 2622 |
free(copy); |
2623 | 2623 |
return -1; |
... | ... |
@@ -2695,7 +2694,7 @@ rfc822comments(const char *in, char *out) |
2695 | 2695 |
if(out == NULL) { |
2696 | 2696 |
out = cli_malloc(strlen(in) + 1); |
2697 | 2697 |
if(out == NULL) { |
2698 |
- cli_errmsg("rfc822comments: Unable to allocate memory for out %u\n", strlen(in) + 1); |
|
2698 |
+ cli_errmsg("rfc822comments: Unable to allocate memory for out %lu\n", strlen(in) + 1); |
|
2699 | 2699 |
return NULL; |
2700 | 2700 |
} |
2701 | 2701 |
} |
... | ... |
@@ -2763,7 +2762,7 @@ rfc2047(const char *in) |
2763 | 2763 |
out = cli_malloc(strlen(in) + 1); |
2764 | 2764 |
|
2765 | 2765 |
if(out == NULL) { |
2766 |
- cli_errmsg("rfc2047: Unable to allocate memory for out %u\n", strlen(in) + 1); |
|
2766 |
+ cli_errmsg("rfc2047: Unable to allocate memory for out %lu\n", strlen(in) + 1); |
|
2767 | 2767 |
return NULL; |
2768 | 2768 |
} |
2769 | 2769 |
|
... | ... |
@@ -3197,6 +3196,8 @@ checkURLs(message *mainMessage, mbox_ctx *mctx, mbox_status *rc, int is_html) |
3197 | 3197 |
blob *b; |
3198 | 3198 |
tag_arguments_t hrefs; |
3199 | 3199 |
|
3200 |
+ UNUSEDPARAM(is_html); |
|
3201 |
+ |
|
3200 | 3202 |
if(*rc == VIRUS) |
3201 | 3203 |
return; |
3202 | 3204 |
|
... | ... |
@@ -67,7 +67,6 @@ enum MBR_STATE { |
67 | 67 |
|
68 | 68 |
static int mbr_scanextprtn(cli_ctx *ctx, unsigned *prtncount, off_t extlba, |
69 | 69 |
size_t extlbasize, size_t sectorsize); |
70 |
-static void mbr_printbr(struct mbr_boot_record *record); |
|
71 | 70 |
static int mbr_check_mbr(struct mbr_boot_record *record, size_t maplen, size_t sectorsize); |
72 | 71 |
static int mbr_check_ebr(struct mbr_boot_record *record); |
73 | 72 |
static int mbr_primary_prtn_intxn(cli_ctx *ctx, struct mbr_boot_record mbr, size_t sectorsize); |
... | ... |
@@ -425,24 +424,6 @@ void mbr_convert_to_host(struct mbr_boot_record *record) |
425 | 425 |
record->signature = be16_to_host(record->signature); |
426 | 426 |
} |
427 | 427 |
|
428 |
-static void mbr_printbr(struct mbr_boot_record *record) |
|
429 |
-{ |
|
430 |
- unsigned i; |
|
431 |
- |
|
432 |
- cli_dbgmsg("signature: %x\n", record->signature); |
|
433 |
- for (i = 0; i < MBR_MAX_PARTITION_ENTRIES; ++i) { |
|
434 |
- cli_dbgmsg("entry %u:\n", i); |
|
435 |
- cli_dbgmsg("\tstatus: %x\n", record->entries[i].status); |
|
436 |
- cli_dbgmsg("\tfirstCHS: [%u, %u, %u]\n", record->entries[i].firstCHS[0], |
|
437 |
- record->entries[i].firstCHS[1], record->entries[i].firstCHS[2]); |
|
438 |
- cli_dbgmsg("\ttype: %x\n", record->entries[i].type); |
|
439 |
- cli_dbgmsg("\tlastCHS: [%u, %u, %u]\n", record->entries[i].lastCHS[0], |
|
440 |
- record->entries[i].lastCHS[1], record->entries[i].lastCHS[2]); |
|
441 |
- cli_dbgmsg("\tfirstLBA: %u\n", record->entries[i].firstLBA); |
|
442 |
- cli_dbgmsg("\tnumLBA: %u\n", record->entries[i].numLBA); |
|
443 |
- } |
|
444 |
-} |
|
445 |
- |
|
446 | 428 |
static int mbr_check_mbr(struct mbr_boot_record *record, size_t maplen, size_t sectorsize) |
447 | 429 |
{ |
448 | 430 |
unsigned i = 0; |
... | ... |
@@ -58,7 +58,7 @@ |
58 | 58 |
#ifdef DEBUGMPOOL |
59 | 59 |
#define spam(...) cli_warnmsg( __VA_ARGS__) |
60 | 60 |
#else |
61 |
-static inline void spam(const char *fmt, ...) { fmt = fmt; } /* gcc STFU */ |
|
61 |
+static inline void spam(const char *fmt, ...) { UNUSEDPARAM(fmt); } |
|
62 | 62 |
#endif |
63 | 63 |
|
64 | 64 |
#include "mpool.h" |
... | ... |
@@ -127,7 +127,7 @@ static int mszip_read_input(struct mszip_stream *zip) { |
127 | 127 |
int nread = zip->read_cb(zip->file, zip->inbuf, (int)zip->inbuf_size); |
128 | 128 |
if (nread < 0) { |
129 | 129 |
if (zip->file->error == CL_BREAK) { |
130 |
- if (nread == zip->last) { |
|
130 |
+ if ((unsigned int)nread == zip->last) { |
|
131 | 131 |
cli_dbgmsg("mszip_read_input: Two consecutive CL_BREAKs reached.\n"); |
132 | 132 |
return CL_BREAK; |
133 | 133 |
} |
... | ... |
@@ -34,61 +34,6 @@ |
34 | 34 |
#include "bzlib_private.h" |
35 | 35 |
#include "others.h" |
36 | 36 |
|
37 |
-static const Int32 BZ2_rNums[512] = { |
|
38 |
- 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, |
|
39 |
- 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, |
|
40 |
- 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, |
|
41 |
- 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, |
|
42 |
- 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, |
|
43 |
- 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, |
|
44 |
- 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, |
|
45 |
- 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, |
|
46 |
- 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, |
|
47 |
- 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, |
|
48 |
- 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, |
|
49 |
- 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, |
|
50 |
- 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, |
|
51 |
- 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, |
|
52 |
- 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, |
|
53 |
- 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, |
|
54 |
- 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, |
|
55 |
- 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, |
|
56 |
- 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, |
|
57 |
- 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, |
|
58 |
- 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, |
|
59 |
- 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, |
|
60 |
- 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, |
|
61 |
- 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, |
|
62 |
- 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, |
|
63 |
- 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, |
|
64 |
- 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, |
|
65 |
- 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, |
|
66 |
- 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, |
|
67 |
- 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, |
|
68 |
- 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, |
|
69 |
- 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, |
|
70 |
- 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, |
|
71 |
- 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, |
|
72 |
- 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, |
|
73 |
- 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, |
|
74 |
- 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, |
|
75 |
- 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, |
|
76 |
- 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, |
|
77 |
- 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, |
|
78 |
- 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, |
|
79 |
- 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, |
|
80 |
- 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, |
|
81 |
- 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, |
|
82 |
- 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, |
|
83 |
- 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, |
|
84 |
- 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, |
|
85 |
- 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, |
|
86 |
- 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, |
|
87 |
- 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, |
|
88 |
- 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, |
|
89 |
- 936, 638 |
|
90 |
-}; |
|
91 |
- |
|
92 | 37 |
/*---------------------------------------------------*/ |
93 | 38 |
static |
94 | 39 |
void makeMaps_d ( DState* s ) |
... | ... |
@@ -1045,14 +990,16 @@ int bz_config_ok ( void ) |
1045 | 1045 |
static |
1046 | 1046 |
void* default_bzalloc ( void* opaque, Int32 items, Int32 size ) |
1047 | 1047 |
{ |
1048 |
- void* v = cli_malloc ( items * size ); |
|
1049 |
- return v; |
|
1048 |
+ UNUSEDPARAM(opaque); |
|
1049 |
+ void* v = cli_malloc ( items * size ); |
|
1050 |
+ return v; |
|
1050 | 1051 |
} |
1051 | 1052 |
|
1052 | 1053 |
static |
1053 | 1054 |
void default_bzfree ( void* opaque, void* addr ) |
1054 | 1055 |
{ |
1055 |
- if (addr != NULL) free ( addr ); |
|
1056 |
+ UNUSEDPARAM(opaque); |
|
1057 |
+ if (addr != NULL) free ( addr ); |
|
1056 | 1058 |
} |
1057 | 1059 |
|
1058 | 1060 |
/*---------------------------------------------------*/ |
... | ... |
@@ -187,7 +187,7 @@ static int nsis_decomp(struct nsis_st *n) { |
187 | 187 |
static int nsis_unpack_next(struct nsis_st *n, cli_ctx *ctx) { |
188 | 188 |
const unsigned char *ibuf; |
189 | 189 |
uint32_t size, loops; |
190 |
- int ret, gotsome=0, opened=0; |
|
190 |
+ int ret, gotsome=0; |
|
191 | 191 |
unsigned char obuf[BUFSIZ]; |
192 | 192 |
|
193 | 193 |
if (n->eof) { |
... | ... |
@@ -32,6 +32,8 @@ |
32 | 32 |
#endif |
33 | 33 |
#include "json_api.h" |
34 | 34 |
|
35 |
+#include "ooxml.h" |
|
36 |
+ |
|
35 | 37 |
#if HAVE_LIBXML2 |
36 | 38 |
#ifdef _WIN32 |
37 | 39 |
#ifndef LIBXML_WRITER_ENABLED |
... | ... |
@@ -74,17 +76,17 @@ static int ooxml_parse_value(json_object *wrkptr, const char *arrname, const xml |
74 | 74 |
return CL_EMEM; |
75 | 75 |
} |
76 | 76 |
|
77 |
- if (ooxml_is_int(node_value, xmlStrlen(node_value), &val)) { |
|
77 |
+ if (ooxml_is_int((const char *)node_value, xmlStrlen(node_value), &val)) { |
|
78 | 78 |
newobj = json_object_new_int(val); |
79 | 79 |
} |
80 |
- else if (!xmlStrcmp(node_value, "true")) { |
|
80 |
+ else if (!xmlStrcmp(node_value, (const xmlChar *)"true")) { |
|
81 | 81 |
newobj = json_object_new_boolean(1); |
82 | 82 |
} |
83 |
- else if (!xmlStrcmp(node_value, "false")) { |
|
83 |
+ else if (!xmlStrcmp(node_value, (const xmlChar *)"false")) { |
|
84 | 84 |
newobj = json_object_new_boolean(0); |
85 | 85 |
} |
86 | 86 |
else { |
87 |
- newobj = json_object_new_string(node_value); |
|
87 |
+ newobj = json_object_new_string((const char *)node_value); |
|
88 | 88 |
} |
89 | 89 |
|
90 | 90 |
if (NULL == newobj) { |
... | ... |
@@ -218,7 +220,7 @@ static int ooxml_parse_element(cli_ctx *ctx, xmlTextReaderPtr reader, json_objec |
218 | 218 |
|
219 | 219 |
/* check recursion level */ |
220 | 220 |
if (rlvl >= OOXML_JSON_RECLEVEL_MAX) { |
221 |
- cli_dbgmsg("ooxml_parse_element: reached ooxml json recursion limit\n", node_name); |
|
221 |
+ cli_dbgmsg("ooxml_parse_element: reached ooxml json recursion limit\n"); |
|
222 | 222 |
/* skip it */ |
223 | 223 |
xmlTextReaderNext(reader); |
224 | 224 |
//return CL_EMAXREC; |
... | ... |
@@ -238,7 +240,7 @@ static int ooxml_parse_element(cli_ctx *ctx, xmlTextReaderPtr reader, json_objec |
238 | 238 |
cli_dbgmsg("ooxml_parse_element: element tag node nameless\n"); |
239 | 239 |
return CL_EPARSE; /* no name, nameless */ |
240 | 240 |
} |
241 |
- element_tag = ooxml_check_key(node_name, xmlStrlen(node_name)); |
|
241 |
+ element_tag = ooxml_check_key((const char *)node_name, xmlStrlen(node_name)); |
|
242 | 242 |
if (!element_tag) { |
243 | 243 |
cli_dbgmsg("ooxml_parse_element: invalid element tag [%s]\n", node_name); |
244 | 244 |
/* skip it */ |
... | ... |
@@ -274,7 +276,7 @@ static int ooxml_parse_element(cli_ctx *ctx, xmlTextReaderPtr reader, json_objec |
274 | 274 |
|
275 | 275 |
cli_dbgmsg("%s: %s\n", name, value); |
276 | 276 |
|
277 |
- cli_jsonstr(attributes, name, value); |
|
277 |
+ cli_jsonstr(attributes, name, (const char *)value); |
|
278 | 278 |
} |
279 | 279 |
} |
280 | 280 |
|
... | ... |
@@ -310,7 +312,7 @@ static int ooxml_parse_element(cli_ctx *ctx, xmlTextReaderPtr reader, json_objec |
310 | 310 |
return CL_EPARSE; /* no name, nameless */ |
311 | 311 |
} |
312 | 312 |
|
313 |
- end_tag = ooxml_check_key(node_name, xmlStrlen(node_name)); |
|
313 |
+ end_tag = ooxml_check_key((const char *)node_name, xmlStrlen(node_name)); |
|
314 | 314 |
if (!end_tag) { |
315 | 315 |
cli_dbgmsg("ooxml_parse_element: invalid element end tag [%s]\n", node_name); |
316 | 316 |
return CL_EFORMAT; /* unrecognized element tag */ |
... | ... |
@@ -426,7 +428,7 @@ static int ooxml_content_cb(int fd, cli_ctx *ctx) |
426 | 426 |
name = xmlTextReaderConstLocalName(reader); |
427 | 427 |
if (name == NULL) continue; |
428 | 428 |
|
429 |
- if (strcmp(name, "Override")) continue; |
|
429 |
+ if (strcmp((const char *)name, "Override")) continue; |
|
430 | 430 |
|
431 | 431 |
if (!xmlTextReaderHasAttributes(reader)) continue; |
432 | 432 |
|
... | ... |
@@ -436,10 +438,10 @@ static int ooxml_content_cb(int fd, cli_ctx *ctx) |
436 | 436 |
value = xmlTextReaderConstValue(reader); |
437 | 437 |
if (name == NULL || value == NULL) continue; |
438 | 438 |
|
439 |
- if (!xmlStrcmp(name, "ContentType")) { |
|
439 |
+ if (!xmlStrcmp(name, (const xmlChar *)"ContentType")) { |
|
440 | 440 |
CT = value; |
441 | 441 |
} |
442 |
- else if (!xmlStrcmp(name, "PartName")) { |
|
442 |
+ else if (!xmlStrcmp(name, (const xmlChar *)"PartName")) { |
|
443 | 443 |
PN = value; |
444 | 444 |
} |
445 | 445 |
|
... | ... |
@@ -448,10 +450,10 @@ static int ooxml_content_cb(int fd, cli_ctx *ctx) |
448 | 448 |
|
449 | 449 |
if (!CT && !PN) continue; |
450 | 450 |
|
451 |
- if (!xmlStrcmp(CT, "application/vnd.openxmlformats-package.core-properties+xml")) { |
|
451 |
+ if (!xmlStrcmp(CT, (const xmlChar *)"application/vnd.openxmlformats-package.core-properties+xml")) { |
|
452 | 452 |
if (!core) { |
453 | 453 |
/* default: /docProps/core.xml*/ |
454 |
- tmp = unzip_search(ctx, PN+1, xmlStrlen(PN)-1, &loff); |
|
454 |
+ tmp = unzip_search(ctx, (const char *)(PN+1), xmlStrlen(PN)-1, &loff); |
|
455 | 455 |
if (tmp == CL_ETIMEOUT) { |
456 | 456 |
ret = tmp; |
457 | 457 |
} |
... | ... |
@@ -466,10 +468,10 @@ static int ooxml_content_cb(int fd, cli_ctx *ctx) |
466 | 466 |
} |
467 | 467 |
} |
468 | 468 |
} |
469 |
- else if (!xmlStrcmp(CT, "application/vnd.openxmlformats-officedocument.extended-properties+xml")) { |
|
469 |
+ else if (!xmlStrcmp(CT, (const xmlChar *)"application/vnd.openxmlformats-officedocument.extended-properties+xml")) { |
|
470 | 470 |
if (!extn) { |
471 | 471 |
/* default: /docProps/app.xml */ |
472 |
- tmp = unzip_search(ctx, PN+1, xmlStrlen(PN)-1, &loff); |
|
472 |
+ tmp = unzip_search(ctx, (const char *)(PN+1), xmlStrlen(PN)-1, &loff); |
|
473 | 473 |
if (tmp == CL_ETIMEOUT) { |
474 | 474 |
ret = tmp; |
475 | 475 |
} |
... | ... |
@@ -484,10 +486,10 @@ static int ooxml_content_cb(int fd, cli_ctx *ctx) |
484 | 484 |
} |
485 | 485 |
} |
486 | 486 |
} |
487 |
- else if (!xmlStrcmp(CT, "application/vnd.openxmlformats-officedocument.custom-properties+xml")) { |
|
487 |
+ else if (!xmlStrcmp(CT, (const xmlChar *)"application/vnd.openxmlformats-officedocument.custom-properties+xml")) { |
|
488 | 488 |
if (!cust) { |
489 | 489 |
/* default: /docProps/custom.xml */ |
490 |
- tmp = unzip_search(ctx, PN+1, xmlStrlen(PN)-1, &loff); |
|
490 |
+ tmp = unzip_search(ctx, (const char *)(PN+1), xmlStrlen(PN)-1, &loff); |
|
491 | 491 |
if (tmp == CL_ETIMEOUT) { |
492 | 492 |
ret = tmp; |
493 | 493 |
} |
... | ... |
@@ -502,7 +504,7 @@ static int ooxml_content_cb(int fd, cli_ctx *ctx) |
502 | 502 |
} |
503 | 503 |
} |
504 | 504 |
} |
505 |
- else if (!xmlStrcmp(CT, "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml")) { |
|
505 |
+ else if (!xmlStrcmp(CT, (const xmlChar *)"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml")) { |
|
506 | 506 |
dsig++; |
507 | 507 |
} |
508 | 508 |
|
... | ... |
@@ -566,6 +568,7 @@ int cli_process_ooxml(cli_ctx *ctx) |
566 | 566 |
|
567 | 567 |
return unzip_single_internal(ctx, loff, ooxml_content_cb); |
568 | 568 |
#else |
569 |
+ UNUSEDPARAM(ctx); |
|
569 | 570 |
cli_dbgmsg("in cli_processooxml\n"); |
570 | 571 |
#if !HAVE_LIBXML2 |
571 | 572 |
cli_dbgmsg("cli_process_ooxml: libxml2 needs to enabled!"); |
... | ... |
@@ -252,7 +252,7 @@ int openioc_parse(const char * fname, int fd, struct cl_engine *engine, unsigned |
252 | 252 |
|
253 | 253 |
elem = elems; |
254 | 254 |
elems = elems->next; |
255 |
- hash = elem->hash; |
|
255 |
+ hash = (char *)(elem->hash); |
|
256 | 256 |
while (isspace(*hash)) |
257 | 257 |
hash++; |
258 | 258 |
hashlen = strlen(hash); |
... | ... |
@@ -286,6 +286,8 @@ int cl_init(unsigned int initoptions) |
286 | 286 |
struct timeval tv; |
287 | 287 |
unsigned int pid = (unsigned int) getpid(); |
288 | 288 |
|
289 |
+ UNUSEDPARAM(initoptions); |
|
290 |
+ |
|
289 | 291 |
cl_initialize_crypto(); |
290 | 292 |
|
291 | 293 |
{ |
... | ... |
@@ -766,8 +768,6 @@ struct cl_settings *cl_engine_settings_copy(const struct cl_engine *engine) |
766 | 766 |
|
767 | 767 |
int cl_engine_settings_apply(struct cl_engine *engine, const struct cl_settings *settings) |
768 | 768 |
{ |
769 |
- cli_intel_t *intel; |
|
770 |
- |
|
771 | 769 |
engine->ac_only = settings->ac_only; |
772 | 770 |
engine->ac_mindepth = settings->ac_mindepth; |
773 | 771 |
engine->ac_maxdepth = settings->ac_maxdepth; |
... | ... |
@@ -1163,7 +1163,7 @@ int cli_rmdirs(const char *dirname) |
1163 | 1163 |
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) { |
1164 | 1164 |
path = cli_malloc(strlen(dirname) + strlen(dent->d_name) + 2); |
1165 | 1165 |
if(!path) { |
1166 |
- cli_errmsg("cli_rmdirs: Unable to allocate memory for path %u\n", strlen(dirname) + strlen(dent->d_name) + 2); |
|
1166 |
+ cli_errmsg("cli_rmdirs: Unable to allocate memory for path %lu\n", strlen(dirname) + strlen(dent->d_name) + 2); |
|
1167 | 1167 |
closedir(dd); |
1168 | 1168 |
return -1; |
1169 | 1169 |
} |
... | ... |
@@ -121,6 +121,9 @@ uint8_t cli_always_gen_section_hash = 0; |
121 | 121 |
|
122 | 122 |
static void fputs_callback(enum cl_msg severity, const char *fullmsg, const char *msg, void *context) |
123 | 123 |
{ |
124 |
+ UNUSEDPARAM(severity); |
|
125 |
+ UNUSEDPARAM(msg); |
|
126 |
+ UNUSEDPARAM(context); |
|
124 | 127 |
fputs(fullmsg, stderr); |
125 | 128 |
} |
126 | 129 |
|
... | ... |
@@ -23,7 +23,6 @@ |
23 | 23 |
* TODO: Embedded fonts |
24 | 24 |
* TODO: Predictor image handling |
25 | 25 |
*/ |
26 |
-static char const rcsid[] = "$Id: pdf.c,v 1.61 2007/02/12 20:46:09 njh Exp $"; |
|
27 | 26 |
|
28 | 27 |
#if HAVE_CONFIG_H |
29 | 28 |
#include "clamav-config.h" |
... | ... |
@@ -288,6 +287,8 @@ int pdf_findobj(struct pdf_struct *pdf) |
288 | 288 |
|
289 | 289 |
static int filter_writen(struct pdf_struct *pdf, struct pdf_obj *obj, int fout, const char *buf, off_t len, off_t *sum) |
290 | 290 |
{ |
291 |
+ UNUSEDPARAM(obj); |
|
292 |
+ |
|
291 | 293 |
if (cli_checklimits("pdf", pdf->ctx, *sum, 0, 0)) |
292 | 294 |
return len; /* pretend it was a successful write to suppress CL_EWRITE */ |
293 | 295 |
|
... | ... |
@@ -638,6 +639,8 @@ static int run_pdf_hooks(struct pdf_struct *pdf, enum pdf_phase phase, int fd, i |
638 | 638 |
cli_ctx *ctx = pdf->ctx; |
639 | 639 |
fmap_t *map; |
640 | 640 |
|
641 |
+ UNUSEDPARAM(dumpid); |
|
642 |
+ |
|
641 | 643 |
bc_ctx = cli_bytecode_context_alloc(); |
642 | 644 |
if (!bc_ctx) { |
643 | 645 |
cli_errmsg("cli_pdf: can't allocate memory for bc_ctx"); |
... | ... |
@@ -666,6 +669,7 @@ static int run_pdf_hooks(struct pdf_struct *pdf, enum pdf_phase phase, int fd, i |
666 | 666 |
} |
667 | 667 |
|
668 | 668 |
static void dbg_printhex(const char *msg, const char *hex, unsigned len); |
669 |
+ |
|
669 | 670 |
static void aes_decrypt(const unsigned char *in, off_t *length, unsigned char *q, char *key, unsigned key_n, int has_iv) |
670 | 671 |
{ |
671 | 672 |
unsigned long rk[RKLENGTH(256)]; |
... | ... |
@@ -695,7 +699,7 @@ static void aes_decrypt(const unsigned char *in, off_t *length, unsigned char *q |
695 | 695 |
} |
696 | 696 |
|
697 | 697 |
cli_dbgmsg("aes_decrypt: Calling rijndaelSetupDecrypt\n"); |
698 |
- nrounds = rijndaelSetupDecrypt(rk, key, key_n*8); |
|
698 |
+ nrounds = rijndaelSetupDecrypt(rk, (const unsigned char *)key, key_n*8); |
|
699 | 699 |
cli_dbgmsg("aes_decrypt: Beginning rijndaelDecrypt\n"); |
700 | 700 |
|
701 | 701 |
while (len >= 16) { |
... | ... |
@@ -798,7 +802,7 @@ static char *decrypt_any(struct pdf_struct *pdf, uint32_t id, const char *in, of |
798 | 798 |
break; |
799 | 799 |
case ENC_AESV2: |
800 | 800 |
cli_dbgmsg("cli_pdf: enc is aesv2\n"); |
801 |
- aes_decrypt(in, length, q, result, n, 1); |
|
801 |
+ aes_decrypt((const unsigned char *)in, length, q, (char *)result, n, 1); |
|
802 | 802 |
|
803 | 803 |
noisy_msg(pdf, "decrypted AES(v2) data\n"); |
804 | 804 |
|
... | ... |
@@ -810,7 +814,7 @@ static char *decrypt_any(struct pdf_struct *pdf, uint32_t id, const char *in, of |
810 | 810 |
return NULL; |
811 | 811 |
} |
812 | 812 |
|
813 |
- aes_decrypt(in, length, q, pdf->key, pdf->keylen, 1); |
|
813 |
+ aes_decrypt((const unsigned char *)in, length, q, pdf->key, pdf->keylen, 1); |
|
814 | 814 |
|
815 | 815 |
noisy_msg(pdf, "decrypted AES(v3) data\n"); |
816 | 816 |
|
... | ... |
@@ -839,7 +843,7 @@ static char *decrypt_any(struct pdf_struct *pdf, uint32_t id, const char *in, of |
839 | 839 |
return NULL; |
840 | 840 |
} |
841 | 841 |
|
842 |
- return q; |
|
842 |
+ return (char *)q; |
|
843 | 843 |
} |
844 | 844 |
|
845 | 845 |
static enum enc_method get_enc_method(struct pdf_struct *pdf, struct pdf_obj *obj) |
... | ... |
@@ -885,7 +889,7 @@ static void process(struct text_norm_state *s, enum cstate *st, const char *buf, |
885 | 885 |
if (*buf == ')') { |
886 | 886 |
*st = CSTATE_TJ; |
887 | 887 |
} else { |
888 |
- if (text_normalize_buffer(s, buf, 1) != 1) { |
|
888 |
+ if (text_normalize_buffer(s, (const unsigned char *)buf, 1) != 1) { |
|
889 | 889 |
cli_writen(fout, s->out, s->out_pos); |
890 | 890 |
text_normalize_reset(s); |
891 | 891 |
} |
... | ... |
@@ -917,7 +921,7 @@ static int pdf_scan_contents(int fd, struct pdf_struct *pdf) |
917 | 917 |
return CL_ETMPFILE; |
918 | 918 |
} |
919 | 919 |
|
920 |
- text_normalize_init(&s, outbuff, sizeof(outbuff)); |
|
920 |
+ text_normalize_init(&s, (unsigned char *)outbuff, sizeof(outbuff)); |
|
921 | 921 |
while (1) { |
922 | 922 |
n = cli_readn(fd, inbuf, sizeof(inbuf)); |
923 | 923 |
if (n <= 0) |
... | ... |
@@ -1042,14 +1046,14 @@ int pdf_extract_obj(struct pdf_struct *pdf, struct pdf_obj *obj, uint32_t flags) |
1042 | 1042 |
|
1043 | 1043 |
cli_dbgmsg("cli_pdf: calculated length %ld\n", length); |
1044 | 1044 |
} else { |
1045 |
- if (size > length+2) { |
|
1045 |
+ if (size > (size_t)length+2) { |
|
1046 | 1046 |
cli_dbgmsg("cli_pdf: calculated length %ld < %ld\n", |
1047 | 1047 |
length, size); |
1048 | 1048 |
length = size; |
1049 | 1049 |
} |
1050 | 1050 |
} |
1051 | 1051 |
|
1052 |
- if (orig_length && size > orig_length + 20) { |
|
1052 |
+ if (orig_length && size > (size_t)orig_length + 20) { |
|
1053 | 1053 |
cli_dbgmsg("cli_pdf: orig length: %ld, length: %ld, size: %ld\n", orig_length, length, size); |
1054 | 1054 |
pdfobj_flag(pdf, obj, BAD_STREAMLEN); |
1055 | 1055 |
} |
... | ... |
@@ -1713,8 +1717,6 @@ void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj) |
1713 | 1713 |
objstate = STATE_NONE; |
1714 | 1714 |
trailer_end = pdf_readint(dict, full_dict_length, "/H"); |
1715 | 1715 |
if (trailer_end > 0 && trailer_end < pdf->size) { |
1716 |
- const char *enc; |
|
1717 |
- |
|
1718 | 1716 |
trailer = trailer_end - 1024; |
1719 | 1717 |
if (trailer < 0) |
1720 | 1718 |
trailer = 0; |
... | ... |
@@ -2063,6 +2065,8 @@ static void check_user_password(struct pdf_struct *pdf, int R, const char *O, |
2063 | 2063 |
struct arc4_state arc4; |
2064 | 2064 |
unsigned password_empty = 0; |
2065 | 2065 |
|
2066 |
+ UNUSEDPARAM(oulen); |
|
2067 |
+ |
|
2066 | 2068 |
dbg_printhex("U: ", U, 32); |
2067 | 2069 |
dbg_printhex("O: ", O, 32); |
2068 | 2070 |
if (R == 5) { |
... | ... |
@@ -2071,7 +2075,7 @@ static void check_user_password(struct pdf_struct *pdf, int R, const char *O, |
2071 | 2071 |
/* supplement to ISO3200, 3.5.2 Algorithm 3.11 */ |
2072 | 2072 |
/* user validation salt */ |
2073 | 2073 |
cl_sha256(U+32, 8, result2, NULL); |
2074 |
- dbg_printhex("Computed U", result2, 32); |
|
2074 |
+ dbg_printhex("Computed U", (const char *)result2, 32); |
|
2075 | 2075 |
if (!memcmp(result2, U, 32)) { |
2076 | 2076 |
off_t n; |
2077 | 2077 |
|
... | ... |
@@ -2090,7 +2094,7 @@ static void check_user_password(struct pdf_struct *pdf, int R, const char *O, |
2090 | 2090 |
return; |
2091 | 2091 |
} |
2092 | 2092 |
|
2093 |
- aes_decrypt(UE, &n, pdf->key, result2, 32, 0); |
|
2093 |
+ aes_decrypt((const unsigned char *)UE, &n, (unsigned char *)(pdf->key), (char *)result2, 32, 0); |
|
2094 | 2094 |
dbg_printhex("cli_pdf: Candidate encryption key", pdf->key, pdf->keylen); |
2095 | 2095 |
} |
2096 | 2096 |
} |
... | ... |
@@ -2133,15 +2137,15 @@ static void check_user_password(struct pdf_struct *pdf, int R, const char *O, |
2133 | 2133 |
return; |
2134 | 2134 |
|
2135 | 2135 |
memcpy(pdf->key, result, pdf->keylen); |
2136 |
- dbg_printhex("md5", result, 16); |
|
2136 |
+ dbg_printhex("md5", (const char *)result, 16); |
|
2137 | 2137 |
dbg_printhex("Candidate encryption key", pdf->key, pdf->keylen); |
2138 | 2138 |
|
2139 | 2139 |
/* 7.6.3.3 Algorithm 6 */ |
2140 | 2140 |
if (R == 2) { |
2141 | 2141 |
/* 7.6.3.3 Algorithm 4 */ |
2142 | 2142 |
memcpy(data, key_padding, 32); |
2143 |
- arc4_init(&arc4, pdf->key, pdf->keylen); |
|
2144 |
- arc4_apply(&arc4, data, 32); |
|
2143 |
+ arc4_init(&arc4, (const uint8_t *)(pdf->key), pdf->keylen); |
|
2144 |
+ arc4_apply(&arc4, (uint8_t *)data, 32); |
|
2145 | 2145 |
dbg_printhex("computed U (R2)", data, 32); |
2146 | 2146 |
if (!memcmp(data, U, 32)) |
2147 | 2147 |
password_empty = 1; |
... | ... |
@@ -2159,7 +2163,7 @@ static void check_user_password(struct pdf_struct *pdf, int R, const char *O, |
2159 | 2159 |
cl_hash_data("md5", d, 32 + pdf->fileIDlen, result, NULL); |
2160 | 2160 |
memcpy(data, pdf->key, len); |
2161 | 2161 |
|
2162 |
- arc4_init(&arc4, data, len); |
|
2162 |
+ arc4_init(&arc4, (const uint8_t *)data, len); |
|
2163 | 2163 |
arc4_apply(&arc4, result, 16); |
2164 | 2164 |
for (i=1;i<=19;i++) { |
2165 | 2165 |
unsigned j; |
... | ... |
@@ -2167,12 +2171,12 @@ static void check_user_password(struct pdf_struct *pdf, int R, const char *O, |
2167 | 2167 |
for (j=0;j<len;j++) |
2168 | 2168 |
data[j] = pdf->key[j] ^ i; |
2169 | 2169 |
|
2170 |
- arc4_init(&arc4, data, len); |
|
2170 |
+ arc4_init(&arc4, (const uint8_t *)data, len); |
|
2171 | 2171 |
arc4_apply(&arc4, result, 16); |
2172 | 2172 |
} |
2173 | 2173 |
|
2174 | 2174 |
dbg_printhex("fileID", pdf->fileID, pdf->fileIDlen); |
2175 |
- dbg_printhex("computed U (R>=3)", result, 16); |
|
2175 |
+ dbg_printhex("computed U (R>=3)", (const char *)result, 16); |
|
2176 | 2176 |
if (!memcmp(result, U, 16)) |
2177 | 2177 |
password_empty = 1; |
2178 | 2178 |
} else { |
... | ... |
@@ -2212,7 +2216,7 @@ static enum enc_method parse_enc_method(const char *dict, unsigned len, const ch |
2212 | 2212 |
if (!strcmp(key, "Identity")) |
2213 | 2213 |
return ENC_IDENTITY; |
2214 | 2214 |
|
2215 |
- q = pdf_getdict(dict, &len, key); |
|
2215 |
+ q = pdf_getdict(dict, (int *)(&len), key); |
|
2216 | 2216 |
if (!q) |
2217 | 2217 |
return def; |
2218 | 2218 |
|
... | ... |
@@ -2237,7 +2241,7 @@ static enum enc_method parse_enc_method(const char *dict, unsigned len, const ch |
2237 | 2237 |
static void pdf_handle_enc(struct pdf_struct *pdf) |
2238 | 2238 |
{ |
2239 | 2239 |
struct pdf_obj *obj; |
2240 |
- uint32_t len, required_flags, n, R, P, length, EM = 1, i, oulen; |
|
2240 |
+ uint32_t len, n, R, P, length, EM = 1, i, oulen; |
|
2241 | 2241 |
char *O, *U, *UE, *StmF, *StrF, *EFF; |
2242 | 2242 |
const char *q, *q2; |
2243 | 2243 |
|
... | ... |
@@ -2320,7 +2324,7 @@ static void pdf_handle_enc(struct pdf_struct *pdf) |
2320 | 2320 |
StrF = pdf_readval(q, len, "/StrF"); |
2321 | 2321 |
EFF = pdf_readval(q, len, "/EFF"); |
2322 | 2322 |
n = len; |
2323 |
- pdf->CF = pdf_getdict(q, &n, "/CF"); |
|
2323 |
+ pdf->CF = pdf_getdict(q, (int *)(&n), "/CF"); |
|
2324 | 2324 |
pdf->CF_n = n; |
2325 | 2325 |
|
2326 | 2326 |
if (StmF) |
... | ... |
@@ -2927,6 +2931,9 @@ pdf_nextobject(const char *ptr, size_t len) |
2927 | 2927 |
#if HAVE_JSON |
2928 | 2928 |
static void ASCIIHexDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
2929 | 2929 |
{ |
2930 |
+ UNUSEDPARAM(obj); |
|
2931 |
+ UNUSEDPARAM(act); |
|
2932 |
+ |
|
2930 | 2933 |
if (!(pdf)) |
2931 | 2934 |
return; |
2932 | 2935 |
|
... | ... |
@@ -2937,6 +2944,9 @@ static void ASCIIHexDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struc |
2937 | 2937 |
#if HAVE_JSON |
2938 | 2938 |
static void ASCII85Decode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
2939 | 2939 |
{ |
2940 |
+ UNUSEDPARAM(obj); |
|
2941 |
+ UNUSEDPARAM(act); |
|
2942 |
+ |
|
2940 | 2943 |
if (!(pdf)) |
2941 | 2944 |
return; |
2942 | 2945 |
|
... | ... |
@@ -2947,6 +2957,9 @@ static void ASCII85Decode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct |
2947 | 2947 |
#if HAVE_JSON |
2948 | 2948 |
static void EmbeddedFile_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
2949 | 2949 |
{ |
2950 |
+ UNUSEDPARAM(obj); |
|
2951 |
+ UNUSEDPARAM(act); |
|
2952 |
+ |
|
2950 | 2953 |
if (!(pdf)) |
2951 | 2954 |
return; |
2952 | 2955 |
|
... | ... |
@@ -2957,6 +2970,9 @@ static void EmbeddedFile_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct |
2957 | 2957 |
#if HAVE_JSON |
2958 | 2958 |
static void FlateDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
2959 | 2959 |
{ |
2960 |
+ UNUSEDPARAM(obj); |
|
2961 |
+ UNUSEDPARAM(act); |
|
2962 |
+ |
|
2960 | 2963 |
if (!(pdf)) |
2961 | 2964 |
return; |
2962 | 2965 |
|
... | ... |
@@ -2967,6 +2983,9 @@ static void FlateDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct p |
2967 | 2967 |
#if HAVE_JSON |
2968 | 2968 |
static void Image_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
2969 | 2969 |
{ |
2970 |
+ UNUSEDPARAM(obj); |
|
2971 |
+ UNUSEDPARAM(act); |
|
2972 |
+ |
|
2970 | 2973 |
if (!(pdf)) |
2971 | 2974 |
return; |
2972 | 2975 |
|
... | ... |
@@ -2977,6 +2996,9 @@ static void Image_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname |
2977 | 2977 |
#if HAVE_JSON |
2978 | 2978 |
static void LZWDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
2979 | 2979 |
{ |
2980 |
+ UNUSEDPARAM(obj); |
|
2981 |
+ UNUSEDPARAM(act); |
|
2982 |
+ |
|
2980 | 2983 |
if (!(pdf)) |
2981 | 2984 |
return; |
2982 | 2985 |
|
... | ... |
@@ -2987,6 +3009,9 @@ static void LZWDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdf |
2987 | 2987 |
#if HAVE_JSON |
2988 | 2988 |
static void RunLengthDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
2989 | 2989 |
{ |
2990 |
+ UNUSEDPARAM(obj); |
|
2991 |
+ UNUSEDPARAM(act); |
|
2992 |
+ |
|
2990 | 2993 |
if (!(pdf)) |
2991 | 2994 |
return; |
2992 | 2995 |
|
... | ... |
@@ -2997,6 +3022,9 @@ static void RunLengthDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, stru |
2997 | 2997 |
#if HAVE_JSON |
2998 | 2998 |
static void CCITTFaxDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
2999 | 2999 |
{ |
3000 |
+ UNUSEDPARAM(obj); |
|
3001 |
+ UNUSEDPARAM(act); |
|
3002 |
+ |
|
3000 | 3003 |
if (!(pdf)) |
3001 | 3004 |
return; |
3002 | 3005 |
|
... | ... |
@@ -3007,7 +3035,10 @@ static void CCITTFaxDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struc |
3007 | 3007 |
#if HAVE_JSON |
3008 | 3008 |
static void JBIG2Decode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3009 | 3009 |
{ |
3010 |
- struct json_object *pdfobj, *jbig2arr, *jbig2obj; |
|
3010 |
+ struct json_object *pdfobj, *jbig2arr; |
|
3011 |
+ |
|
3012 |
+ UNUSEDPARAM(obj); |
|
3013 |
+ UNUSEDPARAM(act); |
|
3011 | 3014 |
|
3012 | 3015 |
if (!(pdf)) |
3013 | 3016 |
return; |
... | ... |
@@ -3035,6 +3066,9 @@ static void JBIG2Decode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct p |
3035 | 3035 |
#if HAVE_JSON |
3036 | 3036 |
static void DCTDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3037 | 3037 |
{ |
3038 |
+ UNUSEDPARAM(obj); |
|
3039 |
+ UNUSEDPARAM(act); |
|
3040 |
+ |
|
3038 | 3041 |
if (!(pdf)) |
3039 | 3042 |
return; |
3040 | 3043 |
|
... | ... |
@@ -3045,6 +3079,9 @@ static void DCTDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdf |
3045 | 3045 |
#if HAVE_JSON |
3046 | 3046 |
static void JPXDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3047 | 3047 |
{ |
3048 |
+ UNUSEDPARAM(obj); |
|
3049 |
+ UNUSEDPARAM(act); |
|
3050 |
+ |
|
3048 | 3051 |
if (!(pdf)) |
3049 | 3052 |
return; |
3050 | 3053 |
|
... | ... |
@@ -3055,6 +3092,9 @@ static void JPXDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdf |
3055 | 3055 |
#if HAVE_JSON |
3056 | 3056 |
static void Crypt_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3057 | 3057 |
{ |
3058 |
+ UNUSEDPARAM(obj); |
|
3059 |
+ UNUSEDPARAM(act); |
|
3060 |
+ |
|
3058 | 3061 |
if (!(pdf)) |
3059 | 3062 |
return; |
3060 | 3063 |
|
... | ... |
@@ -3065,6 +3105,9 @@ static void Crypt_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname |
3065 | 3065 |
#if HAVE_JSON |
3066 | 3066 |
static void Standard_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3067 | 3067 |
{ |
3068 |
+ UNUSEDPARAM(obj); |
|
3069 |
+ UNUSEDPARAM(act); |
|
3070 |
+ |
|
3068 | 3071 |
if (!(pdf)) |
3069 | 3072 |
return; |
3070 | 3073 |
|
... | ... |
@@ -3075,6 +3118,9 @@ static void Standard_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfn |
3075 | 3075 |
#if HAVE_JSON |
3076 | 3076 |
static void Sig_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3077 | 3077 |
{ |
3078 |
+ UNUSEDPARAM(obj); |
|
3079 |
+ UNUSEDPARAM(act); |
|
3080 |
+ |
|
3078 | 3081 |
if (!(pdf)) |
3079 | 3082 |
return; |
3080 | 3083 |
|
... | ... |
@@ -3085,7 +3131,9 @@ static void Sig_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_a |
3085 | 3085 |
#if HAVE_JSON |
3086 | 3086 |
static void JavaScript_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3087 | 3087 |
{ |
3088 |
- struct json_object *pdfobj, *jbig2arr, *jbig2obj; |
|
3088 |
+ struct json_object *pdfobj, *jbig2arr; |
|
3089 |
+ |
|
3090 |
+ UNUSEDPARAM(act); |
|
3089 | 3091 |
|
3090 | 3092 |
if (!(pdf)) |
3091 | 3093 |
return; |
... | ... |
@@ -3113,6 +3161,9 @@ static void JavaScript_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pd |
3113 | 3113 |
#if HAVE_JSON |
3114 | 3114 |
static void OpenAction_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3115 | 3115 |
{ |
3116 |
+ UNUSEDPARAM(obj); |
|
3117 |
+ UNUSEDPARAM(act); |
|
3118 |
+ |
|
3116 | 3119 |
if (!(pdf)) |
3117 | 3120 |
return; |
3118 | 3121 |
|
... | ... |
@@ -3123,6 +3174,9 @@ static void OpenAction_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pd |
3123 | 3123 |
#if HAVE_JSON |
3124 | 3124 |
static void Launch_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3125 | 3125 |
{ |
3126 |
+ UNUSEDPARAM(obj); |
|
3127 |
+ UNUSEDPARAM(act); |
|
3128 |
+ |
|
3126 | 3129 |
if (!(pdf)) |
3127 | 3130 |
return; |
3128 | 3131 |
|
... | ... |
@@ -3133,6 +3187,9 @@ static void Launch_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfnam |
3133 | 3133 |
#if HAVE_JSON |
3134 | 3134 |
static void Page_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3135 | 3135 |
{ |
3136 |
+ UNUSEDPARAM(obj); |
|
3137 |
+ UNUSEDPARAM(act); |
|
3138 |
+ |
|
3136 | 3139 |
if (!(pdf)) |
3137 | 3140 |
return; |
3138 | 3141 |
|
... | ... |
@@ -3143,6 +3200,8 @@ static void Page_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_ |
3143 | 3143 |
#if HAVE_JSON |
3144 | 3144 |
static void Author_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3145 | 3145 |
{ |
3146 |
+ UNUSEDPARAM(act); |
|
3147 |
+ |
|
3146 | 3148 |
if (!(pdf)) |
3147 | 3149 |
return; |
3148 | 3150 |
|
... | ... |
@@ -3157,6 +3216,8 @@ static void Author_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfnam |
3157 | 3157 |
#if HAVE_JSON |
3158 | 3158 |
static void Creator_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3159 | 3159 |
{ |
3160 |
+ UNUSEDPARAM(act); |
|
3161 |
+ |
|
3160 | 3162 |
if (!(pdf)) |
3161 | 3163 |
return; |
3162 | 3164 |
|
... | ... |
@@ -3171,6 +3232,8 @@ static void Creator_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfna |
3171 | 3171 |
#if HAVE_JSON |
3172 | 3172 |
static void ModificationDate_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3173 | 3173 |
{ |
3174 |
+ UNUSEDPARAM(act); |
|
3175 |
+ |
|
3174 | 3176 |
if (!(pdf)) |
3175 | 3177 |
return; |
3176 | 3178 |
|
... | ... |
@@ -3185,6 +3248,8 @@ static void ModificationDate_cb(struct pdf_struct *pdf, struct pdf_obj *obj, str |
3185 | 3185 |
#if HAVE_JSON |
3186 | 3186 |
static void CreationDate_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3187 | 3187 |
{ |
3188 |
+ UNUSEDPARAM(act); |
|
3189 |
+ |
|
3188 | 3190 |
if (!(pdf)) |
3189 | 3191 |
return; |
3190 | 3192 |
|
... | ... |
@@ -3199,6 +3264,8 @@ static void CreationDate_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct |
3199 | 3199 |
#if HAVE_JSON |
3200 | 3200 |
static void Producer_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3201 | 3201 |
{ |
3202 |
+ UNUSEDPARAM(act); |
|
3203 |
+ |
|
3202 | 3204 |
if (!(pdf)) |
3203 | 3205 |
return; |
3204 | 3206 |
|
... | ... |
@@ -3213,6 +3280,8 @@ static void Producer_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfn |
3213 | 3213 |
#if HAVE_JSON |
3214 | 3214 |
static void Title_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3215 | 3215 |
{ |
3216 |
+ UNUSEDPARAM(act); |
|
3217 |
+ |
|
3216 | 3218 |
if (!(pdf)) |
3217 | 3219 |
return; |
3218 | 3220 |
|
... | ... |
@@ -3227,6 +3296,8 @@ static void Title_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname |
3227 | 3227 |
#if HAVE_JSON |
3228 | 3228 |
static void Keywords_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3229 | 3229 |
{ |
3230 |
+ UNUSEDPARAM(act); |
|
3231 |
+ |
|
3230 | 3232 |
if (!(pdf)) |
3231 | 3233 |
return; |
3232 | 3234 |
|
... | ... |
@@ -3241,6 +3312,8 @@ static void Keywords_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfn |
3241 | 3241 |
#if HAVE_JSON |
3242 | 3242 |
static void Subject_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3243 | 3243 |
{ |
3244 |
+ UNUSEDPARAM(act); |
|
3245 |
+ |
|
3244 | 3246 |
if (!(pdf)) |
3245 | 3247 |
return; |
3246 | 3248 |
|
... | ... |
@@ -3255,6 +3328,9 @@ static void Subject_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfna |
3255 | 3255 |
#if HAVE_JSON |
3256 | 3256 |
static void RichMedia_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3257 | 3257 |
{ |
3258 |
+ UNUSEDPARAM(obj); |
|
3259 |
+ UNUSEDPARAM(act); |
|
3260 |
+ |
|
3258 | 3261 |
if (!(pdf)) |
3259 | 3262 |
return; |
3260 | 3263 |
|
... | ... |
@@ -3265,6 +3341,9 @@ static void RichMedia_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdf |
3265 | 3265 |
#if HAVE_JSON |
3266 | 3266 |
static void AcroForm_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3267 | 3267 |
{ |
3268 |
+ UNUSEDPARAM(obj); |
|
3269 |
+ UNUSEDPARAM(act); |
|
3270 |
+ |
|
3268 | 3271 |
if (!(pdf)) |
3269 | 3272 |
return; |
3270 | 3273 |
|
... | ... |
@@ -3275,6 +3354,9 @@ static void AcroForm_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfn |
3275 | 3275 |
#if HAVE_JSON |
3276 | 3276 |
static void XFA_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act) |
3277 | 3277 |
{ |
3278 |
+ UNUSEDPARAM(obj); |
|
3279 |
+ UNUSEDPARAM(act); |
|
3280 |
+ |
|
3278 | 3281 |
if (!(pdf)) |
3279 | 3282 |
return; |
3280 | 3283 |
|
... | ... |
@@ -3288,15 +3370,18 @@ static void Pages_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname |
3288 | 3288 |
struct pdf_array *array; |
3289 | 3289 |
const char *objstart = (const char *)(obj->start + pdf->map); |
3290 | 3290 |
const char *begin; |
3291 |
- unsigned int objsz = obj_size(pdf, obj, 1); |
|
3291 |
+ unsigned int objsz; |
|
3292 | 3292 |
unsigned long npages=0, count; |
3293 | 3293 |
struct pdf_array_node *node; |
3294 |
- struct pdf_dict *dict; |
|
3295 | 3294 |
json_object *pdfobj; |
3296 | 3295 |
|
3296 |
+ UNUSEDPARAM(act); |
|
3297 |
+ |
|
3297 | 3298 |
if (!(pdf) || !(pdf->ctx->wrkproperty)) |
3298 | 3299 |
return; |
3299 | 3300 |
|
3301 |
+ objsz = obj_size(pdf, obj, 1); |
|
3302 |
+ |
|
3300 | 3303 |
if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES)) |
3301 | 3304 |
return; |
3302 | 3305 |
|
... | ... |
@@ -3310,7 +3395,7 @@ static void Pages_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname |
3310 | 3310 |
|
3311 | 3311 |
begin += 5; |
3312 | 3312 |
|
3313 |
- array = pdf_parse_array(pdf, obj, objsz, begin, NULL); |
|
3313 |
+ array = pdf_parse_array(pdf, obj, objsz, (char *)begin, NULL); |
|
3314 | 3314 |
if (!(array)) { |
3315 | 3315 |
cli_jsonbool(pdfobj, "IncorrectPagesCount", 1); |
3316 | 3316 |
return; |
... | ... |
@@ -3350,7 +3435,9 @@ static void Colors_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfnam |
3350 | 3350 |
json_object *colorsobj, *pdfobj; |
3351 | 3351 |
unsigned long ncolors; |
3352 | 3352 |
char *start, *p1; |
3353 |
- size_t objsz = obj_size(pdf, obj, 1); |
|
3353 |
+ size_t objsz; |
|
3354 |
+ |
|
3355 |
+ UNUSEDPARAM(act); |
|
3354 | 3356 |
|
3355 | 3357 |
if (!(pdf) || !(pdf->ctx) || !(pdf->ctx->wrkproperty)) |
3356 | 3358 |
return; |
... | ... |
@@ -3358,9 +3445,11 @@ static void Colors_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfnam |
3358 | 3358 |
if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES)) |
3359 | 3359 |
return; |
3360 | 3360 |
|
3361 |
- start = obj->start + pdf->map; |
|
3361 |
+ objsz = obj_size(pdf, obj, 1); |
|
3362 |
+ |
|
3363 |
+ start = (char *)(obj->start + pdf->map); |
|
3362 | 3364 |
|
3363 |
- p1 = cli_memstr(start, objsz, "/Colors", 7); |
|
3365 |
+ p1 = (char *)cli_memstr(start, objsz, "/Colors", 7); |
|
3364 | 3366 |
if (!(p1)) |
3365 | 3367 |
return; |
3366 | 3368 |
|
... | ... |
@@ -3373,7 +3462,7 @@ static void Colors_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfnam |
3373 | 3373 |
while (p1 - start < objsz && isspace(p1[0])) |
3374 | 3374 |
p1++; |
3375 | 3375 |
|
3376 |
- if (p1 - start == objsz) |
|
3376 |
+ if ((size_t)(p1 - start) == objsz) |
|
3377 | 3377 |
return; |
3378 | 3378 |
|
3379 | 3379 |
ncolors = strtoul(p1, NULL, 10); |
... | ... |
@@ -69,6 +69,8 @@ |
69 | 69 |
#include "textnorm.h" |
70 | 70 |
#include "json_api.h" |
71 | 71 |
|
72 |
+char *pdf_convert_utf(char *begin, size_t sz); |
|
73 |
+ |
|
72 | 74 |
char *pdf_convert_utf(char *begin, size_t sz) |
73 | 75 |
{ |
74 | 76 |
char *res=NULL; |
... | ... |
@@ -105,7 +107,7 @@ char *pdf_convert_utf(char *begin, size_t sz) |
105 | 105 |
continue; |
106 | 106 |
} |
107 | 107 |
|
108 |
- iconv(cd, &p1, &inlen, &p2, &outlen); |
|
108 |
+ iconv(cd, (const char **)(&p1), &inlen, &p2, &outlen); |
|
109 | 109 |
|
110 | 110 |
if (outlen == sz) { |
111 | 111 |
/* Decoding unsuccessful right from the start */ |
... | ... |
@@ -223,10 +225,9 @@ char *pdf_parse_string(struct pdf_struct *pdf, struct pdf_obj *obj, const char * |
223 | 223 |
{ |
224 | 224 |
const char *q = objstart; |
225 | 225 |
char *p1, *p2; |
226 |
- size_t inlen, outlen, len, checklen; |
|
227 |
- char *buf, *outbuf, *res; |
|
226 |
+ size_t len, checklen; |
|
227 |
+ char *res; |
|
228 | 228 |
int likelyutf = 0; |
229 |
- unsigned int i; |
|
230 | 229 |
uint32_t objid; |
231 | 230 |
|
232 | 231 |
/* |
... | ... |
@@ -247,22 +248,22 @@ char *pdf_parse_string(struct pdf_struct *pdf, struct pdf_obj *obj, const char * |
247 | 247 |
if (objsize < strlen(str) + 3) |
248 | 248 |
return NULL; |
249 | 249 |
|
250 |
- for (p1=(char *)q; (p1 - q) < objsize-checklen; p1++) |
|
250 |
+ for (p1=(char *)q; (size_t)(p1 - q) < objsize-checklen; p1++) |
|
251 | 251 |
if (!strncmp(p1, str, checklen)) |
252 | 252 |
break; |
253 | 253 |
|
254 |
- if (p1 - q == objsize - checklen) |
|
254 |
+ if ((size_t)(p1 - q) == objsize - checklen) |
|
255 | 255 |
return NULL; |
256 | 256 |
|
257 | 257 |
p1 += checklen; |
258 | 258 |
} else { |
259 |
- p1 = q; |
|
259 |
+ p1 = (char *)q; |
|
260 | 260 |
} |
261 | 261 |
|
262 |
- while ((p1 - q) < objsize && isspace(p1[0])) |
|
262 |
+ while ((size_t)(p1 - q) < objsize && isspace(p1[0])) |
|
263 | 263 |
p1++; |
264 | 264 |
|
265 |
- if ((p1 - q) == objsize) |
|
265 |
+ if ((size_t)(p1 - q) == objsize) |
|
266 | 266 |
return NULL; |
267 | 267 |
|
268 | 268 |
/* |
... | ... |
@@ -272,10 +273,10 @@ char *pdf_parse_string(struct pdf_struct *pdf, struct pdf_obj *obj, const char * |
272 | 272 |
* We should be at the start of the string |
273 | 273 |
*/ |
274 | 274 |
|
275 |
- p2 = q + objsize; |
|
275 |
+ p2 = (char *)(q + objsize); |
|
276 | 276 |
if (is_object_reference(p1, &p2, &objid)) { |
277 | 277 |
struct pdf_obj *newobj; |
278 |
- char *end, *begin; |
|
278 |
+ char *begin; |
|
279 | 279 |
STATBUF sb; |
280 | 280 |
uint32_t objflags; |
281 | 281 |
int fd; |
... | ... |
@@ -368,15 +369,13 @@ char *pdf_parse_string(struct pdf_struct *pdf, struct pdf_obj *obj, const char * |
368 | 368 |
} |
369 | 369 |
|
370 | 370 |
if (*p1 == '<') { |
371 |
- size_t sz; |
|
372 |
- |
|
373 | 371 |
/* Hex string */ |
374 | 372 |
|
375 | 373 |
p2 = p1+1; |
376 |
- while ((p2 - q) < objsize && *p2 != '>') |
|
374 |
+ while ((size_t)(p2 - q) < objsize && *p2 != '>') |
|
377 | 375 |
p2++; |
378 | 376 |
|
379 |
- if (p2 - q == objsize) { |
|
377 |
+ if ((size_t)(p2 - q) == objsize) { |
|
380 | 378 |
return NULL; |
381 | 379 |
} |
382 | 380 |
|
... | ... |
@@ -461,7 +460,7 @@ struct pdf_dict *pdf_parse_dict(struct pdf_struct *pdf, struct pdf_obj *obj, siz |
461 | 461 |
|
462 | 462 |
objstart = (const char *)(obj->start + pdf->map); |
463 | 463 |
|
464 |
- if (begin < objstart || begin - objstart >= objsz - 2) |
|
464 |
+ if (begin < objstart || (size_t)(begin - objstart) >= objsz - 2) |
|
465 | 465 |
return NULL; |
466 | 466 |
|
467 | 467 |
if (begin[0] != '<' || begin[1] != '<') |
... | ... |
@@ -469,7 +468,7 @@ struct pdf_dict *pdf_parse_dict(struct pdf_struct *pdf, struct pdf_obj *obj, siz |
469 | 469 |
|
470 | 470 |
/* Find the end of the dictionary */ |
471 | 471 |
end = begin; |
472 |
- while (end - objstart < objsz) { |
|
472 |
+ while ((size_t)(end - objstart) < objsz) { |
|
473 | 473 |
int increment=1; |
474 | 474 |
if (in_string) { |
475 | 475 |
if (*end == '\\') { |
... | ... |
@@ -489,18 +488,18 @@ struct pdf_dict *pdf_parse_dict(struct pdf_struct *pdf, struct pdf_obj *obj, siz |
489 | 489 |
in_string=1; |
490 | 490 |
break; |
491 | 491 |
case '<': |
492 |
- if (end - objstart <= objsz - 2 && end[1] == '<') |
|
492 |
+ if ((size_t)(end - objstart) <= objsz - 2 && end[1] == '<') |
|
493 | 493 |
ninner++; |
494 | 494 |
increment=2; |
495 | 495 |
break; |
496 | 496 |
case '>': |
497 |
- if (end - objstart <= objsz - 2 && end[1] == '>') |
|
497 |
+ if ((size_t)(end - objstart) <= objsz - 2 && end[1] == '>') |
|
498 | 498 |
ninner--; |
499 | 499 |
increment=2; |
500 | 500 |
break; |
501 | 501 |
} |
502 | 502 |
|
503 |
- if (end - objstart <= objsz - 2) |
|
503 |
+ if ((size_t)(end - objstart) <= objsz - 2) |
|
504 | 504 |
if (end[0] == '>' && end[1] == '>' && ninner == 0) |
505 | 505 |
break; |
506 | 506 |
|
... | ... |
@@ -508,7 +507,7 @@ struct pdf_dict *pdf_parse_dict(struct pdf_struct *pdf, struct pdf_obj *obj, siz |
508 | 508 |
} |
509 | 509 |
|
510 | 510 |
/* More sanity checking */ |
511 |
- if (end - objstart >= objsz - 2) |
|
511 |
+ if ((size_t)(end - objstart) >= objsz - 2) |
|
512 | 512 |
return NULL; |
513 | 513 |
|
514 | 514 |
if (end[0] != '>' || end[1] != '>') |
... | ... |
@@ -609,7 +608,7 @@ struct pdf_dict *pdf_parse_dict(struct pdf_struct *pdf, struct pdf_obj *obj, siz |
609 | 609 |
begin = p1+1; |
610 | 610 |
break; |
611 | 611 |
case '<': |
612 |
- if (begin - objstart < objsz - 2) { |
|
612 |
+ if ((size_t)(begin - objstart) < objsz - 2) { |
|
613 | 613 |
if (begin[1] == '<') { |
614 | 614 |
dict = pdf_parse_dict(pdf, obj, objsz, begin, &p1); |
615 | 615 |
begin = p1+2; |
... | ... |
@@ -717,7 +716,7 @@ struct pdf_array *pdf_parse_array(struct pdf_struct *pdf, struct pdf_obj *obj, s |
717 | 717 |
struct pdf_array *res=NULL; |
718 | 718 |
struct pdf_array_node *node=NULL; |
719 | 719 |
const char *objstart; |
720 |
- char *end, *tempend; |
|
720 |
+ char *end; |
|
721 | 721 |
int in_string=0, ninner=0; |
722 | 722 |
|
723 | 723 |
/* Sanity checking */ |
... | ... |
@@ -726,7 +725,7 @@ struct pdf_array *pdf_parse_array(struct pdf_struct *pdf, struct pdf_obj *obj, s |
726 | 726 |
|
727 | 727 |
objstart = obj->start + pdf->map; |
728 | 728 |
|
729 |
- if (begin < objstart || begin - objstart >= objsz) |
|
729 |
+ if (begin < objstart || (size_t)(begin - objstart) >= objsz) |
|
730 | 730 |
return NULL; |
731 | 731 |
|
732 | 732 |
if (begin[0] != '[') |
... | ... |
@@ -734,7 +733,7 @@ struct pdf_array *pdf_parse_array(struct pdf_struct *pdf, struct pdf_obj *obj, s |
734 | 734 |
|
735 | 735 |
/* Find the end of the array */ |
736 | 736 |
end = begin; |
737 |
- while (end - objstart < objsz) { |
|
737 |
+ while ((size_t)(end - objstart) < objsz) { |
|
738 | 738 |
if (in_string) { |
739 | 739 |
if (*end == '\\') { |
740 | 740 |
end += 2; |
... | ... |
@@ -767,7 +766,7 @@ struct pdf_array *pdf_parse_array(struct pdf_struct *pdf, struct pdf_obj *obj, s |
767 | 767 |
} |
768 | 768 |
|
769 | 769 |
/* More sanity checking */ |
770 |
- if (end - objstart == objsz) |
|
770 |
+ if ((size_t)(end - objstart) == objsz) |
|
771 | 771 |
return NULL; |
772 | 772 |
|
773 | 773 |
if (*end != ']') |
... | ... |
@@ -791,7 +790,7 @@ struct pdf_array *pdf_parse_array(struct pdf_struct *pdf, struct pdf_obj *obj, s |
791 | 791 |
|
792 | 792 |
switch (begin[0]) { |
793 | 793 |
case '<': |
794 |
- if (begin - objstart < objsz - 2 && begin[1] == '<') { |
|
794 |
+ if ((size_t)(begin - objstart) < objsz - 2 && begin[1] == '<') { |
|
795 | 795 |
dict = pdf_parse_dict(pdf, obj, objsz, begin, &begin); |
796 | 796 |
begin+=2; |
797 | 797 |
break; |
... | ... |
@@ -21,11 +21,18 @@ |
21 | 21 |
#if HAVE_CONFIG_H |
22 | 22 |
#include "clamav-config.h" |
23 | 23 |
#endif |
24 |
+ |
|
25 |
+/* |
|
24 | 26 |
#define _XOPEN_SOURCE 500 |
27 |
+*/ |
|
28 |
+ |
|
25 | 29 |
#include <stdio.h> |
30 |
+#include <stdlib.h> |
|
31 |
+ |
|
26 | 32 |
#if HAVE_STRING_H |
27 | 33 |
#include <string.h> |
28 | 34 |
#endif |
35 |
+ |
|
29 | 36 |
#include <sys/types.h> |
30 | 37 |
#include <sys/stat.h> |
31 | 38 |
#include <fcntl.h> |
... | ... |
@@ -739,7 +746,6 @@ int cli_scanpe(cli_ctx *ctx) |
739 | 739 |
size_t fsize; |
740 | 740 |
uint32_t valign, falign, hdr_size, j; |
741 | 741 |
struct cli_exe_section *exe_sections; |
742 |
- struct cli_matcher *mdb_sect; |
|
743 | 742 |
char timestr[32]; |
744 | 743 |
struct pe_image_data_dir *dirs; |
745 | 744 |
struct cli_bc_ctx *bc_ctx; |
... | ... |
@@ -748,8 +754,7 @@ int cli_scanpe(cli_ctx *ctx) |
748 | 748 |
#ifdef HAVE__INTERNAL__SHA_COLLECT |
749 | 749 |
int sha_collect = ctx->sha_collect; |
750 | 750 |
#endif |
751 |
- const char * virname = NULL; |
|
752 |
- const char *archtype=NULL, *subsystem=NULL; |
|
751 |
+ const char *archtype=NULL, *subsystem=NULL; |
|
753 | 752 |
uint32_t viruses_found = 0; |
754 | 753 |
#if HAVE_JSON |
755 | 754 |
int toval = 0; |
... | ... |
@@ -1869,7 +1874,7 @@ int cli_scanpe(cli_ctx *ctx) |
1869 | 1869 |
return CL_EMEM; |
1870 | 1870 |
} |
1871 | 1871 |
|
1872 |
- if(fmap_readn(map, dest, 0, ssize) != ssize) { |
|
1872 |
+ if((unsigned int)fmap_readn(map, dest, 0, ssize) != ssize) { |
|
1873 | 1873 |
cli_dbgmsg("Upack: Can't read raw data of section 0\n"); |
1874 | 1874 |
free(dest); |
1875 | 1875 |
break; |
... | ... |
@@ -1877,7 +1882,7 @@ int cli_scanpe(cli_ctx *ctx) |
1877 | 1877 |
|
1878 | 1878 |
if(upack) memmove(dest + exe_sections[2].rva - exe_sections[0].rva, dest, ssize); |
1879 | 1879 |
|
1880 |
- if(fmap_readn(map, dest + exe_sections[1].rva - off, exe_sections[1].uraw, exe_sections[1].ursz) != exe_sections[1].ursz) { |
|
1880 |
+ if((unsigned int)fmap_readn(map, dest + exe_sections[1].rva - off, exe_sections[1].uraw, exe_sections[1].ursz) != exe_sections[1].ursz) { |
|
1881 | 1881 |
cli_dbgmsg("Upack: Can't read raw data of section 1\n"); |
1882 | 1882 |
free(dest); |
1883 | 1883 |
break; |
... | ... |
@@ -2052,7 +2057,7 @@ int cli_scanpe(cli_ctx *ctx) |
2052 | 2052 |
} |
2053 | 2053 |
|
2054 | 2054 |
if((sections = (struct cli_exe_section *) cli_malloc((sectcnt + 1) * sizeof(struct cli_exe_section))) == NULL) { |
2055 |
- cli_errmsg("FSG: Unable to allocate memory for sections %u\n", (sectcnt + 1) * sizeof(struct cli_exe_section)); |
|
2055 |
+ cli_errmsg("FSG: Unable to allocate memory for sections %lu\n", (sectcnt + 1) * sizeof(struct cli_exe_section)); |
|
2056 | 2056 |
free(exe_sections); |
2057 | 2057 |
return CL_EMEM; |
2058 | 2058 |
} |
... | ... |
@@ -2156,7 +2161,7 @@ int cli_scanpe(cli_ctx *ctx) |
2156 | 2156 |
} |
2157 | 2157 |
|
2158 | 2158 |
if((sections = (struct cli_exe_section *) cli_malloc((sectcnt + 1) * sizeof(struct cli_exe_section))) == NULL) { |
2159 |
- cli_errmsg("FSG: Unable to allocate memory for sections %u\n", (sectcnt + 1) * sizeof(struct cli_exe_section)); |
|
2159 |
+ cli_errmsg("FSG: Unable to allocate memory for sections %lu\n", (sectcnt + 1) * sizeof(struct cli_exe_section)); |
|
2160 | 2160 |
free(exe_sections); |
2161 | 2161 |
return CL_EMEM; |
2162 | 2162 |
} |
... | ... |
@@ -2239,7 +2244,7 @@ int cli_scanpe(cli_ctx *ctx) |
2239 | 2239 |
|
2240 | 2240 |
if(epbuff[1] != '\xbe' || skew <= 0 || skew > 0xfff) { /* FIXME: legit skews?? */ |
2241 | 2241 |
skew = 0; |
2242 |
- } else if (skew > ssize) { |
|
2242 |
+ } else if ((unsigned int)skew > ssize) { |
|
2243 | 2243 |
/* Ignore suggested skew larger than section size */ |
2244 | 2244 |
skew = 0; |
2245 | 2245 |
} else { |
... | ... |
@@ -2395,7 +2400,7 @@ int cli_scanpe(cli_ctx *ctx) |
2395 | 2395 |
|
2396 | 2396 |
for(i = 0 ; i < nsections; i++) { |
2397 | 2397 |
if(exe_sections[i].raw) { |
2398 |
- if(!exe_sections[i].rsz || fmap_readn(map, dest + exe_sections[i].rva - min, exe_sections[i].raw, exe_sections[i].ursz) != exe_sections[i].ursz) { |
|
2398 |
+ if(!exe_sections[i].rsz || (unsigned int)fmap_readn(map, dest + exe_sections[i].rva - min, exe_sections[i].raw, exe_sections[i].ursz) != exe_sections[i].ursz) { |
|
2399 | 2399 |
free(exe_sections); |
2400 | 2400 |
free(dest); |
2401 | 2401 |
return CL_CLEAN; |
... | ... |
@@ -2549,7 +2554,7 @@ int cli_scanpe(cli_ctx *ctx) |
2549 | 2549 |
for(i = 0 ; i < (unsigned int)nsections-1; i++) { |
2550 | 2550 |
if(!exe_sections[i].rsz) continue; |
2551 | 2551 |
if(!CLI_ISCONTAINED(src, ssize, src+exe_sections[i].rva, exe_sections[i].rsz)) break; |
2552 |
- if(fmap_readn(map, src+exe_sections[i].rva, exe_sections[i].raw, exe_sections[i].rsz)!=exe_sections[i].rsz) break; |
|
2552 |
+ if((unsigned int)fmap_readn(map, src+exe_sections[i].rva, exe_sections[i].raw, exe_sections[i].rsz)!=exe_sections[i].rsz) break; |
|
2553 | 2553 |
} |
2554 | 2554 |
if(i+1!=nsections) { |
2555 | 2555 |
cli_dbgmsg("WWpack: Probably hacked/damaged file.\n"); |
... | ... |
@@ -2599,7 +2604,7 @@ int cli_scanpe(cli_ctx *ctx) |
2599 | 2599 |
for(i = 0 ; i < (unsigned int)nsections; i++) { |
2600 | 2600 |
if(!exe_sections[i].rsz) continue; |
2601 | 2601 |
if(!CLI_ISCONTAINED(src, ssize, src+exe_sections[i].rva, exe_sections[i].rsz)) break; |
2602 |
- if(fmap_readn(map, src+exe_sections[i].rva, exe_sections[i].raw, exe_sections[i].rsz)!=exe_sections[i].rsz) break; |
|
2602 |
+ if((unsigned int)fmap_readn(map, src+exe_sections[i].rva, exe_sections[i].raw, exe_sections[i].rsz)!=exe_sections[i].rsz) break; |
|
2603 | 2603 |
} |
2604 | 2604 |
if(i!=nsections) { |
2605 | 2605 |
cli_dbgmsg("Aspack: Probably hacked/damaged Aspack file.\n"); |
... | ... |
@@ -2743,7 +2748,7 @@ int cli_peheader(fmap_t *map, struct cli_exe_info *peinfo) |
2743 | 2743 |
struct pe_image_optional_hdr32 opt32; |
2744 | 2744 |
} pe_opt; |
2745 | 2745 |
struct pe_image_section_hdr *section_hdr; |
2746 |
- int i; |
|
2746 |
+ unsigned int i; |
|
2747 | 2747 |
unsigned int err, pe_plus = 0; |
2748 | 2748 |
uint32_t valign, falign, hdr_size; |
2749 | 2749 |
size_t fsize; |
... | ... |
@@ -2939,7 +2944,7 @@ int cli_peheader(fmap_t *map, struct cli_exe_info *peinfo) |
2939 | 2939 |
if(vinfo_sz <= 6 + 0x20 + 2 + 0x34 || |
2940 | 2940 |
vinfo_val_sz != 0x34 || |
2941 | 2941 |
memcmp(vptr+6, "V\0S\0_\0V\0E\0R\0S\0I\0O\0N\0_\0I\0N\0F\0O\0\0\0", 0x20) || |
2942 |
- cli_readint32(vptr + 0x28) != 0xfeef04bd) { |
|
2942 |
+ (unsigned int)cli_readint32(vptr + 0x28) != 0xfeef04bd) { |
|
2943 | 2943 |
/* - there should be enough room for the header(6), the key "VS_VERSION_INFO"(20), the padding(2) and the value(34) |
2944 | 2944 |
* - the value should be sizeof(fixedfileinfo) |
2945 | 2945 |
* - the key should match |
... | ... |
@@ -3162,7 +3167,7 @@ int cli_checkfp_pe(cli_ctx *ctx, uint8_t *authsha1, stats_section_t *hashes, uin |
3162 | 3162 |
} else { /* PE+ */ |
3163 | 3163 |
size_t readlen = sizeof(struct pe_image_optional_hdr64) - sizeof(struct pe_image_optional_hdr32); |
3164 | 3164 |
/* read the remaining part of the header */ |
3165 |
- if(fmap_readn(map, &optional_hdr32 + 1, at, readlen) != readlen) |
|
3165 |
+ if((size_t)fmap_readn(map, &optional_hdr32 + 1, at, readlen) != readlen) |
|
3166 | 3166 |
return CL_EFORMAT; |
3167 | 3167 |
|
3168 | 3168 |
at += sizeof(struct pe_image_optional_hdr64) - sizeof(struct pe_image_optional_hdr32); |
... | ... |
@@ -3257,12 +3262,12 @@ int cli_checkfp_pe(cli_ctx *ctx, uint8_t *authsha1, stats_section_t *hashes, uin |
3257 | 3257 |
return CL_EFORMAT; \ |
3258 | 3258 |
} \ |
3259 | 3259 |
if (flags & CL_CHECKFP_PE_FLAG_AUTHENTICODE && hashctx) \ |
3260 |
- cl_update_hash(hashctx, hptr, size); \ |
|
3260 |
+ cl_update_hash(hashctx, (void *)hptr, size); \ |
|
3261 | 3261 |
if (isStatAble && flags & CL_CHECKFP_PE_FLAG_STATS) { \ |
3262 | 3262 |
void *md5ctx; \ |
3263 | 3263 |
md5ctx = cl_hash_init("md5"); \ |
3264 | 3264 |
if (md5ctx) { \ |
3265 |
- cl_update_hash(md5ctx, hptr, size); \ |
|
3265 |
+ cl_update_hash(md5ctx, (void *)hptr, size); \ |
|
3266 | 3266 |
cl_finish_hash(md5ctx, hashes->sections[section].md5); \ |
3267 | 3267 |
} \ |
3268 | 3268 |
} \ |
... | ... |
@@ -3314,7 +3319,7 @@ int cli_checkfp_pe(cli_ctx *ctx, uint8_t *authsha1, stats_section_t *hashes, uin |
3314 | 3314 |
} |
3315 | 3315 |
|
3316 | 3316 |
while (flags & CL_CHECKFP_PE_FLAG_AUTHENTICODE) { |
3317 |
- if(at < fsize) { |
|
3317 |
+ if((size_t)at < fsize) { |
|
3318 | 3318 |
hlen = fsize - at; |
3319 | 3319 |
if(dirs[4].Size > hlen) { |
3320 | 3320 |
if (flags & CL_CHECKFP_PE_FLAG_STATS) { |
... | ... |
@@ -67,7 +67,9 @@ int cli_groupiconscan(struct ICON_ENV *icon_env, uint32_t rva); |
67 | 67 |
static int groupicon_scan_cb(void *ptr, uint32_t type, uint32_t name, uint32_t lang, uint32_t rva) { |
68 | 68 |
struct ICON_ENV *icon_env = ptr; |
69 | 69 |
int ret = CL_CLEAN; |
70 |
- type = type; lang = lang; /* Prevent compiler warnings regarding unused variables */ |
|
70 |
+ |
|
71 |
+ UNUSEDPARAM(type); |
|
72 |
+ UNUSEDPARAM(lang); |
|
71 | 73 |
|
72 | 74 |
cli_dbgmsg("groupicon_cb: scanning group %x\n", name); |
73 | 75 |
if(!icon_env->gcnt || icon_env->lastg == name) { |
... | ... |
@@ -89,8 +91,10 @@ static int parseicon(struct ICON_ENV *icon_env, uint32_t rva); |
89 | 89 |
|
90 | 90 |
static int icon_scan_cb(void *ptr, uint32_t type, uint32_t name, uint32_t lang, uint32_t rva) { |
91 | 91 |
struct ICON_ENV *icon_env = ptr; |
92 |
- type = type; lang = lang; /* Prevent compiler warnings regarding unused variables */ |
|
93 |
- //cli_dbgmsg("icon_cb: scanning icon %x\n", name); |
|
92 |
+ |
|
93 |
+ UNUSEDPARAM(type); |
|
94 |
+ UNUSEDPARAM(lang); |
|
95 |
+ UNUSEDPARAM(name); |
|
94 | 96 |
|
95 | 97 |
/* scan icon */ |
96 | 98 |
icon_env->result = parseicon(icon_env, rva); |
... | ... |
@@ -164,7 +168,6 @@ int cli_scanicon(icon_groupset *set, uint32_t resdir_rva, cli_ctx *ctx, struct c |
164 | 164 |
int cli_groupiconscan(struct ICON_ENV *icon_env, uint32_t rva) |
165 | 165 |
{ |
166 | 166 |
/* import environment */ |
167 |
- icon_groupset *set = icon_env->set; |
|
168 | 167 |
uint32_t resdir_rva = icon_env->resdir_rva; |
169 | 168 |
cli_ctx *ctx = icon_env->ctx; |
170 | 169 |
struct cli_exe_section *exe_sections = icon_env->exe_sections; |
... | ... |
@@ -173,7 +176,7 @@ int cli_groupiconscan(struct ICON_ENV *icon_env, uint32_t rva) |
173 | 173 |
|
174 | 174 |
int err = 0; |
175 | 175 |
fmap_t *map = *ctx->fmap; |
176 |
- const uint8_t *grp = fmap_need_off_once(map, cli_rawaddr(rva, exe_sections, nsections, &err, map->len, hdr_size), 16); |
|
176 |
+ const uint8_t *grp = fmap_need_off_once(map, cli_rawaddr(rva, exe_sections, nsections, (unsigned int *)(&err), map->len, hdr_size), 16); |
|
177 | 177 |
|
178 | 178 |
if(grp && !err) { |
179 | 179 |
uint32_t gsz = cli_readint32(grp + 4); |
... | ... |
@@ -191,7 +194,7 @@ int cli_groupiconscan(struct ICON_ENV *icon_env, uint32_t rva) |
191 | 191 |
uint16_t id; |
192 | 192 |
} *dir; |
193 | 193 |
|
194 |
- raddr = cli_rawaddr(cli_readint32(grp), exe_sections, nsections, &err, map->len, hdr_size); |
|
194 |
+ raddr = cli_rawaddr(cli_readint32(grp), exe_sections, nsections, (unsigned int *)(&err), map->len, hdr_size); |
|
195 | 195 |
cli_dbgmsg("cli_scanicon: icon group @%x\n", raddr); |
196 | 196 |
grp = fmap_need_off_once(map, raddr, gsz); |
197 | 197 |
if(grp && !err) { |
... | ... |
@@ -776,7 +779,7 @@ static void makebmp(const char *step, const char *tempd, int w, int h, void *dat |
776 | 776 |
return; |
777 | 777 |
} |
778 | 778 |
|
779 |
- for(y=h-1; y<h; y--) |
|
779 |
+ for(y=h-1; y<(unsigned int)h; y--) |
|
780 | 780 |
#if WORDS_BIGENDIAN == 0 |
781 | 781 |
if(!fwrite(&((unsigned int *)data)[y*w], w*4, 1, f)) |
782 | 782 |
break; |
... | ... |
@@ -793,7 +796,7 @@ static void makebmp(const char *step, const char *tempd, int w, int h, void *dat |
793 | 793 |
} |
794 | 794 |
#endif |
795 | 795 |
fclose(f); |
796 |
- if(y<h) |
|
796 |
+ if(y<(unsigned int)h) |
|
797 | 797 |
cli_unlink(fname); |
798 | 798 |
else |
799 | 799 |
cli_dbgmsg("makebmp: Image %s dumped to %s\n", step, fname); |
... | ... |
@@ -1047,7 +1050,7 @@ static int getmetrics(unsigned int side, unsigned int *imagedata, struct icomtr |
1047 | 1047 |
#ifdef USE_FLOATS |
1048 | 1048 |
sobel = cli_malloc(side * side * sizeof(double)); |
1049 | 1049 |
if(!sobel) { |
1050 |
- cli_errmsg("getmetrics: Unable to allocate memory for edge detection %u\n", (side * side * sizeof(double))); |
|
1050 |
+ cli_errmsg("getmetrics: Unable to allocate memory for edge detection %lu\n", (side * side * sizeof(double))); |
|
1051 | 1051 |
free(tmp); |
1052 | 1052 |
return CL_EMEM; |
1053 | 1053 |
} |
... | ... |
@@ -1341,7 +1344,7 @@ static int parseicon(struct ICON_ENV *icon_env, uint32_t rva) { |
1341 | 1341 |
return CL_SUCCESS; |
1342 | 1342 |
} |
1343 | 1343 |
|
1344 |
- if(READ32(bmphdr.sz) < sizeof(bmphdr)) { |
|
1344 |
+ if((size_t)READ32(bmphdr.sz) < sizeof(bmphdr)) { |
|
1345 | 1345 |
icon_env->err_bhts++; |
1346 | 1346 |
//cli_dbgmsg("parseicon: BMP header too small\n"); |
1347 | 1347 |
return CL_SUCCESS; |
... | ... |
@@ -1193,6 +1193,8 @@ static int hash_match(const struct regex_matcher *rlist, const char *host, size_ |
1193 | 1193 |
s[hlen+plen] = '\0'; |
1194 | 1194 |
cli_dbgmsg("hash lookup for: %s\n",s); |
1195 | 1195 |
#endif |
1196 |
+ UNUSEDPARAM(prefix_matched); |
|
1197 |
+ |
|
1196 | 1198 |
if(rlist->sha256_hashes.bm_patterns) { |
1197 | 1199 |
const char hexchars[] = "0123456789ABCDEF"; |
1198 | 1200 |
unsigned char h[65]; |
... | ... |
@@ -1204,8 +1206,8 @@ static int hash_match(const struct regex_matcher *rlist, const char *host, size_ |
1204 | 1204 |
if (!(sha256)) |
1205 | 1205 |
return CL_EMEM; |
1206 | 1206 |
|
1207 |
- cl_update_hash(sha256, host, hlen); |
|
1208 |
- cl_update_hash(sha256, path, plen); |
|
1207 |
+ cl_update_hash(sha256, (void *)host, hlen); |
|
1208 |
+ cl_update_hash(sha256, (void *)path, plen); |
|
1209 | 1209 |
cl_finish_hash(sha256, sha256_dig); |
1210 | 1210 |
|
1211 | 1211 |
for(i=0;i<32;i++) { |
... | ... |
@@ -56,11 +56,6 @@ typedef unsigned long ulg; |
56 | 56 |
#define CRITICAL(chunkID) (!ANCILLARY(chunkID)) |
57 | 57 |
#define PUBLIC(chunkID) (!PRIVATE(chunkID)) |
58 | 58 |
|
59 |
-/* what the PNG, MNG and JNG magic numbers should be */ |
|
60 |
-static const uch good_PNG_magic[8] = {137, 80, 78, 71, 13, 10, 26, 10}; |
|
61 |
-static const uch good_MNG_magic[8] = {138, 77, 78, 71, 13, 10, 26, 10}; |
|
62 |
-static const uch good_JNG_magic[8] = {139, 74, 78, 71, 13, 10, 26, 10}; |
|
63 |
- |
|
64 | 59 |
/* GRR FIXME: could merge all three of these into single table (bit fields) */ |
65 | 60 |
|
66 | 61 |
/* GRR 20061203: for "isalpha()" that works even on EBCDIC machines */ |
... | ... |
@@ -51,13 +51,13 @@ int prtn_intxn_list_check(prtn_intxn_list_t* list, unsigned *pitxn, off_t start, |
51 | 51 |
(*pitxn)--; |
52 | 52 |
|
53 | 53 |
if (start > check_node->Start) { |
54 |
- if (check_node->Start+check_node->Size > start) { |
|
54 |
+ if (check_node->Start+check_node->Size > (unsigned long)start) { |
|
55 | 55 |
ret = CL_VIRUS; |
56 | 56 |
break; |
57 | 57 |
} |
58 | 58 |
} |
59 | 59 |
else if (start < check_node->Start) { |
60 |
- if (start+size > check_node->Start) { |
|
60 |
+ if (start+size > (unsigned long)(check_node->Start)) { |
|
61 | 61 |
ret = CL_VIRUS; |
62 | 62 |
break; |
63 | 63 |
} |
... | ... |
@@ -348,6 +348,7 @@ int cli_initroots(struct cl_engine *engine, unsigned int options) |
348 | 348 |
int i, ret; |
349 | 349 |
struct cli_matcher *root; |
350 | 350 |
|
351 |
+ UNUSEDPARAM(options); |
|
351 | 352 |
|
352 | 353 |
for(i = 0; i < CLI_MTARGETS; i++) { |
353 | 354 |
if(!engine->root[i]) { |
... | ... |
@@ -546,6 +547,7 @@ static int cli_loaddb(FILE *fs, struct cl_engine *engine, unsigned int *signo, u |
546 | 546 |
int ret = 0; |
547 | 547 |
struct cli_matcher *root; |
548 | 548 |
|
549 |
+ UNUSEDPARAM(dbname); |
|
549 | 550 |
|
550 | 551 |
if((ret = cli_initroots(engine, options))) |
551 | 552 |
return ret; |
... | ... |
@@ -900,6 +902,7 @@ static int cli_loadndb(FILE *fs, struct cl_engine *engine, unsigned int *signo, |
900 | 900 |
unsigned short target; |
901 | 901 |
unsigned int phish = options & CL_DB_PHISHING; |
902 | 902 |
|
903 |
+ UNUSEDPARAM(dbname); |
|
903 | 904 |
|
904 | 905 |
if((ret = cli_initroots(engine, options))) |
905 | 906 |
return ret; |
... | ... |
@@ -1243,6 +1246,8 @@ static int load_oneldb(char *buffer, int chkpua, struct cl_engine *engine, unsig |
1243 | 1243 |
uint32_t lsigid[2]; |
1244 | 1244 |
int ret; |
1245 | 1245 |
|
1246 |
+ UNUSEDPARAM(dbname); |
|
1247 |
+ |
|
1246 | 1248 |
tokens_count = cli_strtokenize(buffer, ';', LDB_TOKENS + 1, (const char **) tokens); |
1247 | 1249 |
if(tokens_count < 4) { |
1248 | 1250 |
return CL_EMALFDB; |
... | ... |
@@ -1850,6 +1855,8 @@ static int cli_loadign(FILE *fs, struct cl_engine *engine, unsigned int options, |
1850 | 1850 |
struct cli_bm_patt *new; |
1851 | 1851 |
int ret = CL_SUCCESS; |
1852 | 1852 |
|
1853 |
+ UNUSEDPARAM(options); |
|
1854 |
+ |
|
1853 | 1855 |
if(!engine->ignored) { |
1854 | 1856 |
engine->ignored = (struct cli_matcher *) mpool_calloc(engine->mempool, 1, sizeof(struct cli_matcher)); |
1855 | 1857 |
if(!engine->ignored) |
... | ... |
@@ -2000,7 +2007,7 @@ static int cli_loadhash(FILE *fs, struct cl_engine *engine, unsigned int *signo, |
2000 | 2000 |
continue; |
2001 | 2001 |
if(tokens_count == MD5_TOKENS) { |
2002 | 2002 |
int max_fl = atoi(tokens[MD5_TOKENS - 1]); |
2003 |
- if(cl_retflevel() > max_fl) |
|
2003 |
+ if(cl_retflevel() > (unsigned int)max_fl) |
|
2004 | 2004 |
continue; |
2005 | 2005 |
} |
2006 | 2006 |
} |
... | ... |
@@ -2085,6 +2092,7 @@ static int cli_loadmd(FILE *fs, struct cl_engine *engine, unsigned int *signo, i |
2085 | 2085 |
int ret = CL_SUCCESS; |
2086 | 2086 |
struct cli_cdb *new; |
2087 | 2087 |
|
2088 |
+ UNUSEDPARAM(dbname); |
|
2088 | 2089 |
|
2089 | 2090 |
if(engine->ignored) |
2090 | 2091 |
if(!(buffer_cpy = cli_malloc(FILEBUFF))) { |
... | ... |
@@ -2418,12 +2426,11 @@ static int cli_loadcdb(FILE *fs, struct cl_engine *engine, unsigned int *signo, |
2418 | 2418 |
static int cli_loadcrt(FILE *fs, struct cl_engine *engine, struct cli_dbio *dbio) { |
2419 | 2419 |
char buffer[FILEBUFF]; |
2420 | 2420 |
char *tokens[CRT_TOKENS+1]; |
2421 |
- size_t line=0, tokens_count, i, j; |
|
2421 |
+ size_t line=0, tokens_count; |
|
2422 | 2422 |
cli_crt ca; |
2423 | 2423 |
int ret=CL_SUCCESS; |
2424 |
- char *subject=NULL, *pubkey=NULL, *exponent=NULL, *serial=NULL; |
|
2424 |
+ char *subject=NULL, *pubkey=NULL, *serial=NULL; |
|
2425 | 2425 |
const uint8_t exp[] = "\x01\x00\x01"; |
2426 |
- char c; |
|
2427 | 2426 |
|
2428 | 2427 |
cli_crt_init(&ca); |
2429 | 2428 |
memset(ca.issuer, 0xca, sizeof(ca.issuer)); |
... | ... |
@@ -2512,7 +2519,7 @@ static int cli_loadcrt(FILE *fs, struct cl_engine *engine, struct cli_dbio *dbio |
2512 | 2512 |
} |
2513 | 2513 |
|
2514 | 2514 |
memcpy(ca.subject, subject, sizeof(ca.subject)); |
2515 |
- if (mp_read_unsigned_bin(&(ca.n), pubkey, strlen(tokens[4])/2) || mp_read_unsigned_bin(&(ca.e), exp, sizeof(exp)-1)) { |
|
2515 |
+ if (mp_read_unsigned_bin(&(ca.n), (const unsigned char *)pubkey, strlen(tokens[4])/2) || mp_read_unsigned_bin(&(ca.e), exp, sizeof(exp)-1)) { |
|
2516 | 2516 |
cli_errmsg("cli_loadcrt: line %u: Cannot convert exponent to binary data\n", (unsigned int)line); |
2517 | 2517 |
ret = CL_EMALFDB; |
2518 | 2518 |
goto end; |
... | ... |
@@ -2587,6 +2594,9 @@ end: |
2587 | 2587 |
static int cli_loadmscat(FILE *fs, const char *dbname, struct cl_engine *engine, unsigned int options, struct cli_dbio *dbio) { |
2588 | 2588 |
fmap_t *map; |
2589 | 2589 |
|
2590 |
+ UNUSEDPARAM(options); |
|
2591 |
+ UNUSEDPARAM(dbio); |
|
2592 |
+ |
|
2590 | 2593 |
if(!(map = fmap(fileno(fs), 0, 0))) { |
2591 | 2594 |
cli_dbgmsg("Can't map cat: %s\n", dbname); |
2592 | 2595 |
return 0; |
... | ... |
@@ -448,12 +448,12 @@ dissect(struct match *m, char *start, char *stop, sopno startst, sopno stopst) |
448 | 448 |
break; |
449 | 449 |
case OLPAREN: |
450 | 450 |
i = OPND(m->g->strip[ss]); |
451 |
- assert(0 < i && i <= m->g->nsub); |
|
451 |
+ assert(0 < i && (size_t)i <= m->g->nsub); |
|
452 | 452 |
m->pmatch[i].rm_so = sp - m->offp; |
453 | 453 |
break; |
454 | 454 |
case ORPAREN: |
455 | 455 |
i = OPND(m->g->strip[ss]); |
456 |
- assert(0 < i && i <= m->g->nsub); |
|
456 |
+ assert(0 < i && (size_t)i <= m->g->nsub); |
|
457 | 457 |
m->pmatch[i].rm_eo = sp - m->offp; |
458 | 458 |
break; |
459 | 459 |
default: /* uh oh */ |
... | ... |
@@ -572,14 +572,14 @@ backref(struct match *m, char *start, char *stop, sopno startst, sopno stopst, |
572 | 572 |
switch (OP(s)) { |
573 | 573 |
case OBACK_: /* the vilest depths */ |
574 | 574 |
i = OPND(s); |
575 |
- assert(0 < i && i <= m->g->nsub); |
|
575 |
+ assert(0 < i && (size_t)i <= m->g->nsub); |
|
576 | 576 |
if (m->pmatch[i].rm_eo == -1) |
577 | 577 |
return(NULL); |
578 | 578 |
assert(m->pmatch[i].rm_so != -1); |
579 | 579 |
len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so; |
580 | 580 |
if (len == 0 && rec++ > MAX_RECURSION) |
581 | 581 |
return(NULL); |
582 |
- assert(stop - m->beginp >= len); |
|
582 |
+ assert((size_t)(stop - m->beginp) >= len); |
|
583 | 583 |
if (sp > stop - len) |
584 | 584 |
return(NULL); /* not enough left to match */ |
585 | 585 |
ssp = m->offp + m->pmatch[i].rm_so; |
... | ... |
@@ -635,7 +635,7 @@ backref(struct match *m, char *start, char *stop, sopno startst, sopno stopst, |
635 | 635 |
break; |
636 | 636 |
case OLPAREN: /* must undo assignment if rest fails */ |
637 | 637 |
i = OPND(s); |
638 |
- assert(0 < i && i <= m->g->nsub); |
|
638 |
+ assert(0 < i && (size_t)i <= m->g->nsub); |
|
639 | 639 |
offsave = m->pmatch[i].rm_so; |
640 | 640 |
m->pmatch[i].rm_so = sp - m->offp; |
641 | 641 |
dp = backref(m, sp, stop, ss+1, stopst, lev, rec); |
... | ... |
@@ -646,7 +646,7 @@ backref(struct match *m, char *start, char *stop, sopno startst, sopno stopst, |
646 | 646 |
break; |
647 | 647 |
case ORPAREN: /* must undo assignment if rest fails */ |
648 | 648 |
i = OPND(s); |
649 |
- assert(0 < i && i <= m->g->nsub); |
|
649 |
+ assert(0 < i && (size_t)i <= m->g->nsub); |
|
650 | 650 |
offsave = m->pmatch[i].rm_eo; |
651 | 651 |
m->pmatch[i].rm_eo = sp - m->offp; |
652 | 652 |
dp = backref(m, sp, stop, ss+1, stopst, lev, rec); |
... | ... |
@@ -553,7 +553,7 @@ p_simp_re(struct parse *p, |
553 | 553 |
i = (c&~BACKSL) - '0'; |
554 | 554 |
assert(i < NPAREN); |
555 | 555 |
if (p->pend[i] != 0) { |
556 |
- assert(i <= p->g->nsub); |
|
556 |
+ assert((size_t)i <= p->g->nsub); |
|
557 | 557 |
EMIT(OBACK_, i); |
558 | 558 |
assert(p->pbegin[i] != 0); |
559 | 559 |
assert(OP(p->strip[p->pbegin[i]]) == OLPAREN); |
... | ... |
@@ -1196,6 +1196,7 @@ mcadd( struct parse *p, cset *cs, const char *cp) |
1196 | 1196 |
static void |
1197 | 1197 |
mcinvert(struct parse *p, cset *cs) |
1198 | 1198 |
{ |
1199 |
+ UNUSEDPARAM(p); |
|
1199 | 1200 |
assert(cs->multis == NULL); /* xxx */ |
1200 | 1201 |
} |
1201 | 1202 |
|
... | ... |
@@ -1209,6 +1210,7 @@ mcinvert(struct parse *p, cset *cs) |
1209 | 1209 |
static void |
1210 | 1210 |
mccase(struct parse *p, cset *cs) |
1211 | 1211 |
{ |
1212 |
+ UNUSEDPARAM(p); |
|
1212 | 1213 |
assert(cs->multis == NULL); /* xxx */ |
1213 | 1214 |
} |
1214 | 1215 |
|
... | ... |
@@ -157,7 +157,7 @@ cli_regexec(const regex_t *preg, const char *string, size_t nmatch, |
157 | 157 |
return(REG_BADPAT); |
158 | 158 |
eflags = GOODFLAGS(eflags); |
159 | 159 |
|
160 |
- if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags®_LARGE)) |
|
160 |
+ if ((unsigned long)(g->nstates) <= CHAR_BIT*sizeof(states1) && !(eflags®_LARGE)) |
|
161 | 161 |
return(smatcher(g, (char *)string, nmatch, pmatch, eflags)); |
162 | 162 |
else |
163 | 163 |
return(lmatcher(g, (char *)string, nmatch, pmatch, eflags)); |
... | ... |
@@ -704,6 +704,9 @@ static const u32 rcon[] = |
704 | 704 |
(ciphertext)[2] = (u8)((st) >> 8); \ |
705 | 705 |
(ciphertext)[3] = (u8)(st); } |
706 | 706 |
|
707 |
+int rijndaelSetupEncrypt(u32 *rk, const u8 *key, int keybits); |
|
708 |
+void rijndaelEncrypt(const u32 *rk, int nrounds, const u8 plaintext[16], u8 ciphertext[16]); |
|
709 |
+ |
|
707 | 710 |
/** |
708 | 711 |
* Expand the cipher key into the encryption key schedule. |
709 | 712 |
* |
... | ... |
@@ -206,7 +206,7 @@ static char *getsistring(fmap_t *map, uint32_t ptr, uint32_t len) { |
206 | 206 |
cli_dbgmsg("SIS: OOM\n"); |
207 | 207 |
return NULL; |
208 | 208 |
} |
209 |
- if (fmap_readn(map, name, ptr, len) != len) { |
|
209 |
+ if ((uint32_t)fmap_readn(map, name, ptr, len) != len) { |
|
210 | 210 |
cli_dbgmsg("SIS: Unable to read string\n"); |
211 | 211 |
free(name); |
212 | 212 |
return NULL; |
... | ... |
@@ -310,7 +310,7 @@ static int real_scansis(cli_ctx *ctx, const char *tmpd) { |
310 | 310 |
return CL_CLEAN; |
311 | 311 |
} |
312 | 312 |
for (i = 0; i< sis.langs; i++) |
313 |
- alangs[i]=EC16(llangs[i])<MAXLANG ? sislangs[EC16(llangs[i])] : sislangs[0]; |
|
313 |
+ alangs[i]=(size_t)EC16(llangs[i])<MAXLANG ? sislangs[EC16(llangs[i])] : sislangs[0]; |
|
314 | 314 |
|
315 | 315 |
if (!sis.pnames) { |
316 | 316 |
cli_dbgmsg("SIS: Application without a name?\n"); |
... | ... |
@@ -376,7 +376,6 @@ static int real_scansis(cli_ctx *ctx, const char *tmpd) { |
376 | 376 |
const char *sftype; |
377 | 377 |
uint32_t *ptrs, *lens, *olens; |
378 | 378 |
char *fn; |
379 |
- long fpos; |
|
380 | 379 |
|
381 | 380 |
GETD(ftype); |
382 | 381 |
GETD(options); |
... | ... |
@@ -717,7 +716,7 @@ static int real_scansis9x(cli_ctx *ctx, const char *tmpd) { |
717 | 717 |
if (!(src=cli_malloc(ALIGN4(s->fsize[s->level])))) break; |
718 | 718 |
|
719 | 719 |
len = ALIGN4(s->fsize[s->level]); |
720 |
- if (fmap_readn(s->map, src, s->pos, len) != len) { |
|
720 |
+ if ((uint32_t)fmap_readn(s->map, src, s->pos, len) != len) { |
|
721 | 721 |
free(src); |
722 | 722 |
break; |
723 | 723 |
} |
... | ... |
@@ -40,6 +40,10 @@ |
40 | 40 |
#define JSON_BUFSZ 512 |
41 | 41 |
#define SAMPLE_PREFIX "sample_" |
42 | 42 |
|
43 |
+char *hex_encode(char *buf, char *data, size_t len); |
|
44 |
+char *ensure_bufsize(char *buf, size_t *oldsize, size_t used, size_t additional); |
|
45 |
+char *export_stats_to_json(struct cl_engine *engine, cli_intel_t *intel); |
|
46 |
+ |
|
43 | 47 |
char *hex_encode(char *buf, char *data, size_t len) |
44 | 48 |
{ |
45 | 49 |
size_t i; |
... | ... |
@@ -78,7 +82,7 @@ char *ensure_bufsize(char *buf, size_t *oldsize, size_t used, size_t additional) |
78 | 78 |
|
79 | 79 |
char *export_stats_to_json(struct cl_engine *engine, cli_intel_t *intel) |
80 | 80 |
{ |
81 |
- char *buf=NULL, *p, *hostid, md5[33]; |
|
81 |
+ char *buf=NULL, *hostid, md5[33]; |
|
82 | 82 |
cli_flagged_sample_t *sample; |
83 | 83 |
size_t bufsz, curused, i, j; |
84 | 84 |
|
... | ... |
@@ -146,8 +146,8 @@ static int scancws(cli_ctx *ctx, struct swf_file_hdr *hdr) |
146 | 146 |
} |
147 | 147 |
|
148 | 148 |
stream.avail_in = 0; |
149 |
- stream.next_in = inbuff; |
|
150 |
- stream.next_out = outbuff; |
|
149 |
+ stream.next_in = (Bytef *)inbuff; |
|
150 |
+ stream.next_out = (Bytef *)outbuff; |
|
151 | 151 |
stream.zalloc = (alloc_func) NULL; |
152 | 152 |
stream.zfree = (free_func) NULL; |
153 | 153 |
stream.opaque = (voidpf) 0; |
... | ... |
@@ -167,7 +167,7 @@ static int scancws(cli_ctx *ctx, struct swf_file_hdr *hdr) |
167 | 167 |
|
168 | 168 |
do { |
169 | 169 |
if(stream.avail_in == 0) { |
170 |
- stream.next_in = inbuff; |
|
170 |
+ stream.next_in = (Bytef *)inbuff; |
|
171 | 171 |
ret = fmap_readn(map, inbuff, offset, FILEBUFF); |
172 | 172 |
if(ret < 0) { |
173 | 173 |
cli_errmsg("scancws: Error reading SWF file\n"); |
... | ... |
@@ -201,7 +201,7 @@ static int scancws(cli_ctx *ctx, struct swf_file_hdr *hdr) |
201 | 201 |
} |
202 | 202 |
outsize += count; |
203 | 203 |
} |
204 |
- stream.next_out = outbuff; |
|
204 |
+ stream.next_out = (Bytef *)outbuff; |
|
205 | 205 |
stream.avail_out = FILEBUFF; |
206 | 206 |
} while(zret == Z_OK); |
207 | 207 |
|
... | ... |
@@ -22,8 +22,6 @@ |
22 | 22 |
#include "clamav-config.h" |
23 | 23 |
#endif |
24 | 24 |
|
25 |
-static char const rcsid[] = "$Id: tnef.c,v 1.41 2007/02/12 22:22:27 njh Exp $"; |
|
26 |
- |
|
27 | 25 |
#include <stdio.h> |
28 | 26 |
#include <fcntl.h> |
29 | 27 |
|
... | ... |
@@ -68,8 +66,6 @@ cli_tnef(const char *dir, cli_ctx *ctx) |
68 | 68 |
fileblob *fb; |
69 | 69 |
int ret, alldone; |
70 | 70 |
off_t fsize, pos = 0; |
71 |
- STATBUF statb; |
|
72 |
- |
|
73 | 71 |
|
74 | 72 |
fsize = ctx->fmap[0]->len; |
75 | 73 |
|
... | ... |
@@ -204,7 +200,6 @@ cli_tnef(const char *dir, cli_ctx *ctx) |
204 | 204 |
static int |
205 | 205 |
tnef_message(fmap_t *map, off_t *pos, uint16_t type, uint16_t tag, int32_t length, off_t fsize) |
206 | 206 |
{ |
207 |
- uint16_t i16; |
|
208 | 207 |
off_t offset; |
209 | 208 |
#ifdef CL_DEBUG |
210 | 209 |
uint32_t i32; |
... | ... |
@@ -252,7 +247,7 @@ tnef_message(fmap_t *map, off_t *pos, uint16_t type, uint16_t tag, int32_t lengt |
252 | 252 |
cli_errmsg("tnef_message: Unable to allocate memory for string\n"); |
253 | 253 |
return -1; |
254 | 254 |
} |
255 |
- if(fmap_readn(map, string, *pos, (uint32_t)length) != (uint32_t)length) { |
|
255 |
+ if((uint32_t)fmap_readn(map, string, *pos, (uint32_t)length) != (uint32_t)length) { |
|
256 | 256 |
free(string); |
257 | 257 |
return -1; |
258 | 258 |
} |
... | ... |
@@ -285,7 +280,6 @@ static int |
285 | 285 |
tnef_attachment(fmap_t *map, off_t *pos, uint16_t type, uint16_t tag, int32_t length, const char *dir, fileblob **fbref, off_t fsize) |
286 | 286 |
{ |
287 | 287 |
uint32_t todo; |
288 |
- uint16_t i16; |
|
289 | 288 |
off_t offset; |
290 | 289 |
char *string; |
291 | 290 |
|
... | ... |
@@ -303,7 +297,7 @@ tnef_attachment(fmap_t *map, off_t *pos, uint16_t type, uint16_t tag, int32_t le |
303 | 303 |
cli_errmsg("tnef_attachment: Unable to allocate memory for string\n"); |
304 | 304 |
return -1; |
305 | 305 |
} |
306 |
- if(fmap_readn(map, string, *pos, (uint32_t)length) != (uint32_t)length) { |
|
306 |
+ if((uint32_t)fmap_readn(map, string, *pos, (uint32_t)length) != (uint32_t)length) { |
|
307 | 307 |
free(string); |
308 | 308 |
return -1; |
309 | 309 |
} |
... | ... |
@@ -273,7 +273,7 @@ static int make_table(arj_decode_t *decode_data, int nchar, unsigned char *bitle |
273 | 273 |
if (i != (unsigned short) (1 << 16)) { |
274 | 274 |
k = 1 << tablebits; |
275 | 275 |
while (i != k) { |
276 |
- if (i >= tablesize) { |
|
276 |
+ if (i >= (unsigned int)tablesize) { |
|
277 | 277 |
cli_dbgmsg("UNARJ: bounds exceeded\n"); |
278 | 278 |
decode_data->status = CL_EUNPACK; |
279 | 279 |
return CL_EUNPACK; |
... | ... |
@@ -588,7 +588,7 @@ static int decode(arj_metadata_t *metadata) |
588 | 588 |
cli_dbgmsg("UNARJ: bounds exceeded - probably a corrupted file.\n"); |
589 | 589 |
break; |
590 | 590 |
} |
591 |
- if (out_ptr > i && out_ptr < DDICSIZ - MAXMATCH - 1) { |
|
591 |
+ if (out_ptr > (uint32_t)i && out_ptr < DDICSIZ - MAXMATCH - 1) { |
|
592 | 592 |
while ((--j >= 0) && (i < DDICSIZ) && (out_ptr < DDICSIZ)) { |
593 | 593 |
decode_data.text[out_ptr++] = decode_data.text[i++]; |
594 | 594 |
} |
... | ... |
@@ -779,7 +779,7 @@ static int arj_unstore(arj_metadata_t *metadata, int ofd, uint32_t len) |
779 | 779 |
return CL_EFORMAT; |
780 | 780 |
} |
781 | 781 |
metadata->offset += count; |
782 |
- if (cli_writen(ofd, data, count) != count) { |
|
782 |
+ if ((size_t)cli_writen(ofd, data, count) != count) { |
|
783 | 783 |
/* File writing problem */ |
784 | 784 |
return CL_EWRITE; |
785 | 785 |
} |
... | ... |
@@ -807,7 +807,6 @@ static int is_arj_archive(arj_metadata_t *metadata) |
807 | 807 |
static int arj_read_main_header(arj_metadata_t *metadata) |
808 | 808 |
{ |
809 | 809 |
uint16_t header_size, count; |
810 |
- uint32_t crc; |
|
811 | 810 |
arj_main_hdr_t main_hdr; |
812 | 811 |
const char *filename, *comment; |
813 | 812 |
off_t header_offset; |
... | ... |
@@ -984,6 +983,7 @@ static int arj_read_file_header(arj_metadata_t *metadata) |
984 | 984 |
|
985 | 985 |
int cli_unarj_open(fmap_t *map, const char *dirname, arj_metadata_t *metadata, size_t off) |
986 | 986 |
{ |
987 |
+ UNUSEDPARAM(dirname); |
|
987 | 988 |
cli_dbgmsg("in cli_unarj_open\n"); |
988 | 989 |
metadata->map = map; |
989 | 990 |
metadata->offset = off; |
... | ... |
@@ -1014,7 +1014,6 @@ int cli_unarj_prepare_file(const char *dirname, arj_metadata_t *metadata) |
1014 | 1014 |
|
1015 | 1015 |
int cli_unarj_extract_file(const char *dirname, arj_metadata_t *metadata) |
1016 | 1016 |
{ |
1017 |
- off_t offset; |
|
1018 | 1017 |
int ret = CL_SUCCESS; |
1019 | 1018 |
char filename[1024]; |
1020 | 1019 |
|
... | ... |
@@ -18,8 +18,6 @@ |
18 | 18 |
* MA 02110-1301, USA. |
19 | 19 |
*/ |
20 | 20 |
|
21 |
-static char const rcsid[] = "$Id: untar.c,v 1.35 2007/02/12 20:46:09 njh Exp $"; |
|
22 |
- |
|
23 | 21 |
#if HAVE_CONFIG_H |
24 | 22 |
#include "clamav-config.h" |
25 | 23 |
#endif |
... | ... |
@@ -316,7 +314,7 @@ cli_untar(const char *dir, unsigned int posix, cli_ctx *ctx) |
316 | 316 |
char err[128]; |
317 | 317 |
|
318 | 318 |
nbytes = size>512? 512:size; |
319 |
- if (nread && nread < nbytes) |
|
319 |
+ if (nread && nread < (size_t)nbytes) |
|
320 | 320 |
nbytes = nread; |
321 | 321 |
|
322 | 322 |
if (limitnear > 0) { |
... | ... |
@@ -501,7 +501,7 @@ int cli_unzip(cli_ctx *ctx) { |
501 | 501 |
|
502 | 502 |
cli_dbgmsg("in cli_unzip\n"); |
503 | 503 |
fsize = (uint32_t)map->len; |
504 |
- if(sizeof(off_t)!=sizeof(uint32_t) && (off_t)fsize!=map->len) { |
|
504 |
+ if(sizeof(off_t)!=sizeof(uint32_t) && (size_t)fsize!=map->len) { |
|
505 | 505 |
cli_dbgmsg("cli_unzip: file too big\n"); |
506 | 506 |
return CL_CLEAN; |
507 | 507 |
} |
... | ... |
@@ -585,7 +585,7 @@ int unzip_single_internal(cli_ctx *ctx, off_t lhoffl, zip_cb zcb) |
585 | 585 |
|
586 | 586 |
cli_dbgmsg("in cli_unzip_single\n"); |
587 | 587 |
fsize = (uint32_t)(map->len - lhoffl); |
588 |
- if (lhoffl<0 || lhoffl>map->len || (sizeof(off_t)!=sizeof(uint32_t) && (off_t)fsize!=map->len - lhoffl)) { |
|
588 |
+ if (lhoffl<0 || (size_t)lhoffl>map->len || (sizeof(off_t)!=sizeof(uint32_t) && (size_t)fsize!=map->len - lhoffl)) { |
|
589 | 589 |
cli_dbgmsg("cli_unzip: bad offset\n"); |
590 | 590 |
return CL_CLEAN; |
591 | 591 |
} |
... | ... |
@@ -623,7 +623,7 @@ int unzip_search(cli_ctx *ctx, const char *name, size_t nlen, uint32_t *loff) |
623 | 623 |
|
624 | 624 |
map = *ctx->fmap; |
625 | 625 |
fsize = map->len; |
626 |
- if(sizeof(off_t)!=sizeof(uint32_t) && (off_t)fsize!=map->len) { |
|
626 |
+ if(sizeof(off_t)!=sizeof(uint32_t) && fsize!=map->len) { |
|
627 | 627 |
cli_dbgmsg("unzip_search: file too big\n"); |
628 | 628 |
return CL_CLEAN; |
629 | 629 |
} |
... | ... |
@@ -661,7 +661,7 @@ int unzip_search(cli_ctx *ctx, const char *name, size_t nlen, uint32_t *loff) |
661 | 661 |
ret=CL_EMAXFILES; |
662 | 662 |
} |
663 | 663 |
#if HAVE_JSON |
664 |
- if (cli_json_timeout_cycle_check(ctx, &toval) != CL_SUCCESS) { |
|
664 |
+ if (cli_json_timeout_cycle_check(ctx, (int *)(&toval)) != CL_SUCCESS) { |
|
665 | 665 |
return CL_ETIMEOUT; |
666 | 666 |
} |
667 | 667 |
#endif |
... | ... |
@@ -31,6 +31,7 @@ typedef int (*zip_cb)(int fd, cli_ctx *ctx); |
31 | 31 |
#include "others.h" |
32 | 32 |
int cli_unzip(cli_ctx *); |
33 | 33 |
int cli_unzip_single_internal(cli_ctx *, off_t, zip_cb); |
34 |
+int unzip_single_internal(cli_ctx *ctx, off_t lhoffl, zip_cb zcb); |
|
34 | 35 |
int cli_unzip_single(cli_ctx *, off_t); |
35 | 36 |
int unzip_search(cli_ctx *, const char *, size_t, uint32_t *); |
36 | 37 |
|
... | ... |
@@ -318,7 +318,7 @@ int unupack(int upack, char *dest, uint32_t dsize, char *buff, uint32_t vma, uin |
318 | 318 |
save1 = cli_readint32(loc_esi); /* loc_eax = 0x400 */ |
319 | 319 |
loc_esi += 4; |
320 | 320 |
|
321 |
- for (j=0; j<count; j++, loc_edi+=4) /* checked above */ |
|
321 |
+ for (j=0; (uint32_t)j<count; j++, loc_edi+=4) /* checked above */ |
|
322 | 322 |
cli_writeint32(loc_edi, (save1)); |
323 | 323 |
|
324 | 324 |
if (!CLI_ISCONTAINED(dest, dsize, (loc_esi+0x10), 4)) |
... | ... |
@@ -363,7 +363,7 @@ int unupack(int upack, char *dest, uint32_t dsize, char *buff, uint32_t vma, uin |
363 | 363 |
for (j=0; j<4; j++, loc_edi+=4) |
364 | 364 |
cli_writeint32(loc_edi, (1)); |
365 | 365 |
|
366 |
- for (j=0; j<count; j++, loc_edi+=4) |
|
366 |
+ for (j=0; (uint32_t)j<count; j++, loc_edi+=4) |
|
367 | 367 |
cli_writeint32(loc_edi, 0x400); |
368 | 368 |
|
369 | 369 |
loc_edi = dest + cli_readint32(loc_esi) - base; /* read checked above */ |
... | ... |
@@ -244,7 +244,7 @@ int wwunpack(uint8_t *exe, uint32_t exesz, uint8_t *wwsect, struct cli_exe_secti |
244 | 244 |
} |
245 | 245 |
|
246 | 246 |
memset(structs, 0, 0x28); |
247 |
- error = cli_writen(desc, exe, exesz)!=exesz; |
|
247 |
+ error = (uint32_t)cli_writen(desc, exe, exesz)!=exesz; |
|
248 | 248 |
} |
249 | 249 |
return error; |
250 | 250 |
} |
... | ... |
@@ -264,7 +264,7 @@ void submit_post(const char *host, const char *port, const char *method, const c |
264 | 264 |
|
265 | 265 |
cli_dbgmsg("stats - Connected to %s:%s\n", host, port); |
266 | 266 |
|
267 |
- if (send(sockfd, buf, strlen(buf), 0) != strlen(buf)) { |
|
267 |
+ if ((size_t)send(sockfd, buf, strlen(buf), 0) != (size_t)strlen(buf)) { |
|
268 | 268 |
closesocket(sockfd); |
269 | 269 |
free(buf); |
270 | 270 |
return; |
... | ... |
@@ -417,12 +417,14 @@ int cli_scanxar(cli_ctx *ctx) |
417 | 417 |
fmap_t *map = *ctx->fmap; |
418 | 418 |
long length, offset, size, at; |
419 | 419 |
int encoding; |
420 |
- z_stream strm = {0}; |
|
420 |
+ z_stream strm; |
|
421 | 421 |
char *toc, *tmpname; |
422 | 422 |
xmlTextReaderPtr reader = NULL; |
423 | 423 |
int a_hash, e_hash; |
424 | 424 |
unsigned char *a_cksum = NULL, *e_cksum = NULL; |
425 | 425 |
|
426 |
+ memset(&strm, 0x00, sizeof(z_stream)); |
|
427 |
+ |
|
426 | 428 |
/* retrieve xar header */ |
427 | 429 |
if (fmap_readn(*ctx->fmap, &hdr, 0, sizeof(hdr)) != sizeof(hdr)) { |
428 | 430 |
cli_dbgmsg("cli_scanxar: Invalid header, too short.\n"); |
... | ... |
@@ -572,7 +574,7 @@ int cli_scanxar(cli_ctx *ctx) |
572 | 572 |
break; |
573 | 573 |
} |
574 | 574 |
|
575 |
- while (at < map->len && at < offset+hdr.toc_length_compressed+hdr.size+length) { |
|
575 |
+ while ((size_t)at < map->len && (unsigned long)at < offset+hdr.toc_length_compressed+hdr.size+length) { |
|
576 | 576 |
unsigned long avail_in; |
577 | 577 |
void * next_in; |
578 | 578 |
unsigned int bytes = MIN(map->len - at, map->pgsz); |
... | ... |
@@ -672,7 +674,7 @@ int cli_scanxar(cli_ctx *ctx) |
672 | 672 |
|
673 | 673 |
at += CLI_LZMA_HDR_SIZE; |
674 | 674 |
in_remaining -= CLI_LZMA_HDR_SIZE; |
675 |
- while (at < map->len && at < offset+hdr.toc_length_compressed+hdr.size+length) { |
|
675 |
+ while ((size_t)at < map->len && (unsigned long)at < offset+hdr.toc_length_compressed+hdr.size+length) { |
|
676 | 676 |
SizeT avail_in; |
677 | 677 |
SizeT avail_out; |
678 | 678 |
void * next_in; |
... | ... |
@@ -751,7 +753,7 @@ int cli_scanxar(cli_ctx *ctx) |
751 | 751 |
unsigned long write_len; |
752 | 752 |
|
753 | 753 |
if (ctx->engine->maxfilesize) |
754 |
- write_len = MIN(ctx->engine->maxfilesize, length); |
|
754 |
+ write_len = MIN((size_t)(ctx->engine->maxfilesize), (size_t)length); |
|
755 | 755 |
else |
756 | 756 |
write_len = length; |
757 | 757 |
|
... | ... |
@@ -26,10 +26,13 @@ |
26 | 26 |
#include "7z/XzCrc64.h" |
27 | 27 |
#include "xz_iface.h" |
28 | 28 |
|
29 |
-void *__xz_wrap_alloc(void *unused, size_t size) { |
|
29 |
+void *__xz_wrap_alloc(void *unused, size_t size); |
|
30 |
+void __xz_wrap_free(void *unused, void *freeme); |
|
31 |
+ |
|
32 |
+void *__xz_wrap_alloc(void *unused, size_t size) { |
|
33 |
+ UNUSEDPARAM(unused); |
|
30 | 34 |
if(!size || size > CLI_MAX_ALLOCATION) |
31 | 35 |
return NULL; |
32 |
- unused = unused; |
|
33 | 36 |
if(!size || size > CLI_MAX_ALLOCATION) { |
34 | 37 |
cli_dbgmsg("xz_iface: Attempt to allocate %lu bytes exceeds CLI_MAX_ALLOCATION.\n", |
35 | 38 |
(unsigned long int) size); |
... | ... |
@@ -38,7 +41,7 @@ void *__xz_wrap_alloc(void *unused, size_t size) { |
38 | 38 |
return cli_malloc(size); |
39 | 39 |
} |
40 | 40 |
void __xz_wrap_free(void *unused, void *freeme) { |
41 |
- unused = unused; |
|
41 |
+ UNUSEDPARAM(unused); |
|
42 | 42 |
free(freeme); |
43 | 43 |
} |
44 | 44 |
|