diff options
Diffstat (limited to 'recipes-security/clamav/clamav-0.98.5/0009-fix-ssize_t-size_t-off_t-printf-modifier.patch')
-rw-r--r-- | recipes-security/clamav/clamav-0.98.5/0009-fix-ssize_t-size_t-off_t-printf-modifier.patch | 478 |
1 files changed, 0 insertions, 478 deletions
diff --git a/recipes-security/clamav/clamav-0.98.5/0009-fix-ssize_t-size_t-off_t-printf-modifier.patch b/recipes-security/clamav/clamav-0.98.5/0009-fix-ssize_t-size_t-off_t-printf-modifier.patch deleted file mode 100644 index ee60f92..0000000 --- a/recipes-security/clamav/clamav-0.98.5/0009-fix-ssize_t-size_t-off_t-printf-modifier.patch +++ /dev/null | |||
@@ -1,478 +0,0 @@ | |||
1 | From 26516ebe7ae678be78e748bc973835844e369f72 Mon Sep 17 00:00:00 2001 | ||
2 | From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> | ||
3 | Date: Sun, 17 Aug 2014 21:24:03 +0200 | ||
4 | Subject: fix ssize_t/size_t/off_t printf modifier | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | This fixes a segfault on ARM, Sparc, … if 64bit off_t is used. Once LFS | ||
10 | is enabled then off_t becomes 64bit and there is no portable way to express | ||
11 | it except to cast the variable to signed long long. However with LFS | ||
12 | enabled we can spare that cast. | ||
13 | The 32bit Architectures may explode here because the earlier 64bit off_t | ||
14 | consumes two argument slots and the filename (on which glibc uses | ||
15 | strlen()) becomes invalid. | ||
16 | |||
17 | In brief: | ||
18 | ssize_t -> %zd | ||
19 | size_t -> %zu | ||
20 | off_t -> %llu (with LFS enabled) | ||
21 | |||
22 | https://bugzilla.clamav.net/show_bug.cgi?id=11092 | ||
23 | |||
24 | Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> | ||
25 | --- | ||
26 | clamd/clamd.c | 2 +- | ||
27 | clamd/server-th.c | 3 ++- | ||
28 | libclamav/adc.c | 5 +++-- | ||
29 | libclamav/asn1.c | 3 ++- | ||
30 | libclamav/bytecode.c | 4 ++-- | ||
31 | libclamav/bytecode_api.c | 2 +- | ||
32 | libclamav/hashtab.c | 32 +++++++++++++++++++++----------- | ||
33 | libclamav/jsparse/js-norm.c | 6 ++++-- | ||
34 | libclamav/matcher.c | 6 ++++-- | ||
35 | libclamav/pdf.c | 29 +++++++++++++++++++---------- | ||
36 | libclamav/regex_list.c | 5 ++++- | ||
37 | libclamav/scanners.c | 5 +++-- | ||
38 | shared/misc.h | 4 ++++ | ||
39 | shared/output.c | 3 ++- | ||
40 | sigtool/sigtool.c | 3 ++- | ||
41 | 15 files changed, 74 insertions(+), 38 deletions(-) | ||
42 | |||
43 | diff --git a/clamd/clamd.c b/clamd/clamd.c | ||
44 | index ec15eacc8c25..8c87e1bb9a87 100644 | ||
45 | --- a/clamd/clamd.c | ||
46 | +++ b/clamd/clamd.c | ||
47 | @@ -355,7 +355,7 @@ int main(int argc, char **argv) | ||
48 | |||
49 | |||
50 | if(logg_size) | ||
51 | - logg("#Log file size limited to %u bytes.\n", logg_size); | ||
52 | + logg("#Log file size limited to %" PRId64 "bytes.\n", logg_size); | ||
53 | else | ||
54 | logg("#Log file size limit disabled.\n"); | ||
55 | |||
56 | diff --git a/clamd/server-th.c b/clamd/server-th.c | ||
57 | index 5c12811b662b..84086f39fbfb 100644 | ||
58 | --- a/clamd/server-th.c | ||
59 | +++ b/clamd/server-th.c | ||
60 | @@ -689,7 +689,8 @@ static int handle_stream(client_conn_t *conn, struct fd_buf *buf, const struct o | ||
61 | logg("!INSTREAM: Can't write to temporary file.\n"); | ||
62 | *error = 1; | ||
63 | } | ||
64 | - logg("$Processed %lu bytes of chunkdata, pos %lu\n", cmdlen, pos); | ||
65 | + logg("$Processed %" _sizet " bytes of chunkdata, pos %" _sizet "\n", | ||
66 | + cmdlen, pos); | ||
67 | pos += cmdlen; | ||
68 | if (pos == buf->off) { | ||
69 | buf->off = 0; | ||
70 | diff --git a/libclamav/adc.c b/libclamav/adc.c | ||
71 | index 6ad00ea96571..684335f1bfb5 100644 | ||
72 | --- a/libclamav/adc.c | ||
73 | +++ b/libclamav/adc.c | ||
74 | @@ -28,6 +28,7 @@ | ||
75 | #include <string.h> | ||
76 | #endif | ||
77 | |||
78 | +#include "shared/misc.h" | ||
79 | #include "clamav.h" | ||
80 | #include "cltypes.h" | ||
81 | #include "others.h" | ||
82 | @@ -86,8 +87,8 @@ int adc_decompress(adc_stream *strm) | ||
83 | return ADC_DATA_ERROR; | ||
84 | } | ||
85 | |||
86 | - cli_dbgmsg("adc_decompress: avail_in %lu avail_out %lu state %u\n", strm->avail_in, strm->avail_out, strm->state); | ||
87 | - | ||
88 | + cli_dbgmsg("adc_decompress: avail_in %" _sizet " avail_out %" _sizet " state %u\n", | ||
89 | + strm->avail_in, strm->avail_out, strm->state); | ||
90 | while (strm->avail_out) { | ||
91 | /* Exit if needs more in bytes and none available */ | ||
92 | int needsInput; | ||
93 | diff --git a/libclamav/asn1.c b/libclamav/asn1.c | ||
94 | index c6cf0dd00c50..e6f55642640d 100644 | ||
95 | --- a/libclamav/asn1.c | ||
96 | +++ b/libclamav/asn1.c | ||
97 | @@ -24,6 +24,7 @@ | ||
98 | |||
99 | #include <time.h> | ||
100 | |||
101 | +#include "shared/misc.h" | ||
102 | #include "clamav.h" | ||
103 | #include "asn1.h" | ||
104 | #include "bignum.h" | ||
105 | @@ -1481,7 +1482,7 @@ int asn1_check_mscat(struct cl_engine *engine, fmap_t *map, size_t offset, unsig | ||
106 | if (engine->dconf->pe & PE_CONF_DISABLECERT) | ||
107 | return CL_VIRUS; | ||
108 | |||
109 | - cli_dbgmsg("in asn1_check_mscat (offset: %lu)\n", offset); | ||
110 | + cli_dbgmsg("in asn1_check_mscat (offset: %" _sizet ")\n", offset); | ||
111 | crtmgr_init(&certs); | ||
112 | if(crtmgr_add_roots(engine, &certs)) { | ||
113 | crtmgr_free(&certs); | ||
114 | diff --git a/libclamav/bytecode.c b/libclamav/bytecode.c | ||
115 | index 28d2d716f93b..b34f818fdaba 100644 | ||
116 | --- a/libclamav/bytecode.c | ||
117 | +++ b/libclamav/bytecode.c | ||
118 | @@ -1489,8 +1489,8 @@ void cli_sigperf_print() | ||
119 | cli_infomsg (NULL, "%-*s %*s %*s %*s %*s\n", max_name_len, "=============", | ||
120 | 8, "=====", 8, "========", 12, "===========", 9, "========="); | ||
121 | while (elem->run_count) { | ||
122 | - cli_infomsg (NULL, "%-*s %*lu %*lu %*llu %*.2f\n", max_name_len, elem->bc_name, | ||
123 | - 8, elem->run_count, 8, elem->match_count, | ||
124 | + cli_infomsg (NULL, "%-*s %*lu %*lu %*" PRIu64 " %*.2f\n", max_name_len, | ||
125 | + elem->bc_name, 8, elem->run_count, 8, elem->match_count, | ||
126 | 12, elem->usecs, 9, (double)elem->usecs/elem->run_count); | ||
127 | elem++; | ||
128 | } | ||
129 | diff --git a/libclamav/bytecode_api.c b/libclamav/bytecode_api.c | ||
130 | index 5bded4ebaca0..72a9393183a2 100644 | ||
131 | --- a/libclamav/bytecode_api.c | ||
132 | +++ b/libclamav/bytecode_api.c | ||
133 | @@ -122,7 +122,7 @@ int32_t cli_bcapi_seek(struct cli_bc_ctx* ctx, int32_t pos, uint32_t whence) | ||
134 | return -1; | ||
135 | } | ||
136 | if (off < 0 || off > ctx->file_size) { | ||
137 | - cli_dbgmsg("bcapi_seek: out of file: %ld (max %d)\n", | ||
138 | + cli_dbgmsg("bcapi_seek: out of file: %" PRId64 " (max %d)\n", | ||
139 | off, ctx->file_size); | ||
140 | return -1; | ||
141 | } | ||
142 | diff --git a/libclamav/hashtab.c b/libclamav/hashtab.c | ||
143 | index 88e81ba2c2ef..cafce3ac8927 100644 | ||
144 | --- a/libclamav/hashtab.c | ||
145 | +++ b/libclamav/hashtab.c | ||
146 | @@ -25,6 +25,7 @@ | ||
147 | #include <stdio.h> | ||
148 | #include <string.h> | ||
149 | |||
150 | +#include "shared/misc.h" | ||
151 | #include "cltypes.h" | ||
152 | #include "clamav.h" | ||
153 | #include "others.h" | ||
154 | @@ -329,9 +330,10 @@ static int cli_hashtab_grow(struct cli_hashtable *s) | ||
155 | struct cli_element* htable; | ||
156 | size_t i,idx, used = 0; | ||
157 | |||
158 | - cli_dbgmsg("hashtab.c: new capacity: %lu\n",new_capacity); | ||
159 | + cli_dbgmsg("hashtab.c: new capacity: %" _sizet "\n",new_capacity); | ||
160 | if(new_capacity == s->capacity) { | ||
161 | - cli_errmsg("hashtab.c: capacity problem growing from: %lu\n",s->capacity); | ||
162 | + cli_errmsg("hashtab.c: capacity problem growing from: %" _sizet | ||
163 | + "\n", s->capacity); | ||
164 | return CL_EMEM; | ||
165 | } | ||
166 | htable = cli_calloc(new_capacity, sizeof(*s->htable)); | ||
167 | @@ -372,7 +374,7 @@ static int cli_hashtab_grow(struct cli_hashtable *s) | ||
168 | s->used = used; | ||
169 | s->capacity = new_capacity; | ||
170 | s->maxfill = new_capacity*8/10; | ||
171 | - cli_dbgmsg("Table %p size after grow:%ld\n",(void*)s,s->capacity); | ||
172 | + cli_dbgmsg("Table %p size after grow: %" _sizet "\n", s, s->capacity); | ||
173 | PROFILE_GROW_DONE(s); | ||
174 | return CL_SUCCESS; | ||
175 | } | ||
176 | @@ -386,7 +388,7 @@ static int cli_htu32_grow(struct cli_htu32 *s, mpool_t *mempool) | ||
177 | const size_t new_capacity = nearest_power(s->capacity + 1); | ||
178 | struct cli_htu32_element* htable = mpool_calloc(mempool, new_capacity, sizeof(*s->htable)); | ||
179 | size_t i,idx, used = 0; | ||
180 | - cli_dbgmsg("hashtab.c: new capacity: %lu\n",new_capacity); | ||
181 | + cli_dbgmsg("hashtab.c: new capacity: %" _sizet "\n", new_capacity); | ||
182 | if(new_capacity == s->capacity || !htable) | ||
183 | return CL_EMEM; | ||
184 | |||
185 | @@ -422,7 +424,7 @@ static int cli_htu32_grow(struct cli_htu32 *s, mpool_t *mempool) | ||
186 | s->used = used; | ||
187 | s->capacity = new_capacity; | ||
188 | s->maxfill = new_capacity*8/10; | ||
189 | - cli_dbgmsg("Table %p size after grow:%ld\n",(void*)s,s->capacity); | ||
190 | + cli_dbgmsg("Table %p size after grow: %" _sizet "\n", s, s->capacity); | ||
191 | PROFILE_GROW_DONE(s); | ||
192 | return CL_SUCCESS; | ||
193 | } | ||
194 | @@ -437,7 +439,9 @@ const struct cli_element* cli_hashtab_insert(struct cli_hashtable *s, const char | ||
195 | if(!s) | ||
196 | return NULL; | ||
197 | if(s->used > s->maxfill) { | ||
198 | - cli_dbgmsg("hashtab.c:Growing hashtable %p, because it has exceeded maxfill, old size:%ld\n",(void*)s,s->capacity); | ||
199 | + cli_dbgmsg("hashtab.c:Growing hashtable %p, because it has " | ||
200 | + "exceeded maxfill, old size: %" _sizet "\n", s, | ||
201 | + s->capacity); | ||
202 | cli_hashtab_grow(s); | ||
203 | } | ||
204 | do { | ||
205 | @@ -486,7 +490,8 @@ const struct cli_element* cli_hashtab_insert(struct cli_hashtable *s, const char | ||
206 | } while (tries <= s->capacity); | ||
207 | /* no free place found*/ | ||
208 | PROFILE_HASH_EXHAUSTED(s); | ||
209 | - cli_dbgmsg("hashtab.c: Growing hashtable %p, because its full, old size:%ld.\n",(void*)s,s->capacity); | ||
210 | + cli_dbgmsg("hashtab.c: Growing hashtable %p, because its full, " | ||
211 | + "old size: %" _sizet ".\n", s, s->capacity); | ||
212 | } while( cli_hashtab_grow(s) >= 0 ); | ||
213 | cli_warnmsg("hashtab.c: Unable to grow hashtable\n"); | ||
214 | return NULL; | ||
215 | @@ -504,7 +509,9 @@ int cli_htu32_insert(struct cli_htu32 *s, const struct cli_htu32_element *item, | ||
216 | if(!s) | ||
217 | return CL_ENULLARG; | ||
218 | if(s->used > s->maxfill) { | ||
219 | - cli_dbgmsg("hashtab.c:Growing hashtable %p, because it has exceeded maxfill, old size:%ld\n",(void*)s,s->capacity); | ||
220 | + cli_dbgmsg("hashtab.c:Growing hashtable %p, because it has " | ||
221 | + "exceeded maxfill, old size: %" _sizet "\n", s, | ||
222 | + s->capacity); | ||
223 | cli_htu32_grow(s, mempool); | ||
224 | } | ||
225 | do { | ||
226 | @@ -543,7 +550,8 @@ int cli_htu32_insert(struct cli_htu32 *s, const struct cli_htu32_element *item, | ||
227 | } while (tries <= s->capacity); | ||
228 | /* no free place found*/ | ||
229 | PROFILE_HASH_EXHAUSTED(s); | ||
230 | - cli_dbgmsg("hashtab.c: Growing hashtable %p, because its full, old size:%ld.\n",(void*)s,s->capacity); | ||
231 | + cli_dbgmsg("hashtab.c: Growing hashtable %p, because its full, " | ||
232 | + "old size: %" _sizet ".\n", s, s->capacity); | ||
233 | } while( (ret = cli_htu32_grow(s, mempool)) >= 0 ); | ||
234 | cli_warnmsg("hashtab.c: Unable to grow hashtable\n"); | ||
235 | return ret; | ||
236 | @@ -632,11 +640,13 @@ int cli_hashtab_generate_c(const struct cli_hashtable *s,const char* name) | ||
237 | else if(e->key == DELETED_KEY) | ||
238 | printf("\t{DELETED_KEY,0,0},\n"); | ||
239 | else | ||
240 | - printf("\t{\"%s\", %ld, %ld},\n", e->key, e->data, e->len); | ||
241 | + printf("\t{\"%s\", %ld, %" _sizet"},\n", e->key, | ||
242 | + e->data, e->len); | ||
243 | } | ||
244 | printf("};\n"); | ||
245 | printf("const struct cli_hashtable %s = {\n",name); | ||
246 | - printf("\t%s_elements, %ld, %ld, %ld", name, s->capacity, s->used, s->maxfill); | ||
247 | + printf("\t%s_elements, %" _sizet ", %" _sizet" , %" _sizet, name, | ||
248 | + s->capacity, s->used, s->maxfill); | ||
249 | printf("\n};\n"); | ||
250 | |||
251 | PROFILE_REPORT(s); | ||
252 | diff --git a/libclamav/jsparse/js-norm.c b/libclamav/jsparse/js-norm.c | ||
253 | index 85eba72c2e87..9a56aa34856f 100644 | ||
254 | --- a/libclamav/jsparse/js-norm.c | ||
255 | +++ b/libclamav/jsparse/js-norm.c | ||
256 | @@ -34,6 +34,7 @@ | ||
257 | #include <ctype.h> | ||
258 | #include <assert.h> | ||
259 | |||
260 | +#include "shared/misc.h" | ||
261 | #include "clamav.h" | ||
262 | #include "cltypes.h" | ||
263 | #include "jsparse/lexglobal.h" | ||
264 | @@ -525,7 +526,8 @@ static int replace_token_range(struct tokens *dst, size_t start, size_t end, con | ||
265 | { | ||
266 | const size_t len = with ? with->cnt : 0; | ||
267 | size_t i; | ||
268 | - cli_dbgmsg(MODULE "Replacing tokens %lu - %lu with %lu tokens\n",start, end, len); | ||
269 | + cli_dbgmsg(MODULE "Replacing tokens %" _sizet " - %" _sizet " with %" | ||
270 | + _sizet " tokens\n", start, end, len); | ||
271 | if(start >= dst->cnt || end > dst->cnt) | ||
272 | return -1; | ||
273 | for(i=start;i<end;i++) { | ||
274 | @@ -547,7 +549,7 @@ static int append_tokens(struct tokens *dst, const struct tokens *src) | ||
275 | return CL_ENULLARG; | ||
276 | if(tokens_ensure_capacity(dst, dst->cnt + src->cnt)) | ||
277 | return CL_EMEM; | ||
278 | - cli_dbgmsg(MODULE "Appending %lu tokens\n", src->cnt); | ||
279 | + cli_dbgmsg(MODULE "Appending %" _sizet " tokens\n", src->cnt); | ||
280 | memcpy(&dst->data[dst->cnt], src->data, src->cnt * sizeof(dst->data[0])); | ||
281 | dst->cnt += src->cnt; | ||
282 | return CL_SUCCESS; | ||
283 | diff --git a/libclamav/matcher.c b/libclamav/matcher.c | ||
284 | index 3f4f5c1659d5..e684f7122e26 100644 | ||
285 | --- a/libclamav/matcher.c | ||
286 | +++ b/libclamav/matcher.c | ||
287 | @@ -52,6 +52,7 @@ | ||
288 | #include "perflogging.h" | ||
289 | #include "bytecode_priv.h" | ||
290 | #include "bytecode_api_impl.h" | ||
291 | +#include "shared/misc.h" | ||
292 | |||
293 | #ifdef CLI_PERF_LOGGING | ||
294 | |||
295 | @@ -1069,8 +1070,9 @@ int cli_matchmeta(cli_ctx *ctx, const char *fname, size_t fsizec, size_t fsizer, | ||
296 | const struct cli_cdb *cdb; | ||
297 | unsigned int viruses_found = 0; | ||
298 | |||
299 | - cli_dbgmsg("CDBNAME:%s:%lu:%s:%lu:%lu:%d:%u:%u:%p\n", | ||
300 | - cli_ftname(ctx->container_type), fsizec, fname, fsizec, fsizer, encrypted, filepos, res1, res2); | ||
301 | + cli_dbgmsg("CDBNAME:%s:%" _sizet ":%s:%" _sizet ":%" _sizet ":%d:%u:%u:%p\n", | ||
302 | + cli_ftname(ctx->container_type), fsizec, fname, fsizec, fsizer, | ||
303 | + encrypted, filepos, res1, res2); | ||
304 | |||
305 | if (ctx->engine && ctx->engine->cb_meta) | ||
306 | if (ctx->engine->cb_meta(cli_ftname(ctx->container_type), fsizec, fname, fsizer, encrypted, filepos, ctx->cb_ctx) == CL_VIRUS) { | ||
307 | diff --git a/libclamav/pdf.c b/libclamav/pdf.c | ||
308 | index 2e469c1e5d56..2de348e7c3fd 100644 | ||
309 | --- a/libclamav/pdf.c | ||
310 | +++ b/libclamav/pdf.c | ||
311 | @@ -60,6 +60,7 @@ | ||
312 | #include "rijndael.h" | ||
313 | #include "textnorm.h" | ||
314 | #include "json_api.h" | ||
315 | +#include "shared/misc.h" | ||
316 | |||
317 | #ifdef CL_DEBUG | ||
318 | /*#define SAVE_TMP | ||
319 | @@ -1019,10 +1020,12 @@ int pdf_extract_obj(struct pdf_struct *pdf, struct pdf_obj *obj, uint32_t flags) | ||
320 | |||
321 | orig_length = length; | ||
322 | if (length > pdf->size || obj->start + p_stream + length > pdf->size) { | ||
323 | - cli_dbgmsg("cli_pdf: length out of file: %ld + %ld > %ld\n", | ||
324 | - p_stream, length, pdf->size); | ||
325 | - noisy_warnmsg("length out of file, truncated: %ld + %ld > %ld\n", | ||
326 | - p_stream, length, pdf->size); | ||
327 | + cli_dbgmsg("cli_pdf: length out of file: %" PRId64 " + %" | ||
328 | + PRId64 " > % " PRId64 "\n", p_stream, | ||
329 | + length, pdf->size); | ||
330 | + noisy_warnmsg("length out of file, truncated: %" PRId64 | ||
331 | + " + %" PRId64 " > %" PRId64 "\n", | ||
332 | + p_stream, length, pdf->size); | ||
333 | length = pdf->size - (obj->start + p_stream); | ||
334 | } | ||
335 | |||
336 | @@ -1044,17 +1047,21 @@ int pdf_extract_obj(struct pdf_struct *pdf, struct pdf_obj *obj, uint32_t flags) | ||
337 | if (length < 0) | ||
338 | length = 0; | ||
339 | |||
340 | - cli_dbgmsg("cli_pdf: calculated length %ld\n", length); | ||
341 | + cli_dbgmsg("cli_pdf: calculated length %" PRId64 "\n", | ||
342 | + length); | ||
343 | } else { | ||
344 | if (size > (size_t)length+2) { | ||
345 | - cli_dbgmsg("cli_pdf: calculated length %ld < %ld\n", | ||
346 | + cli_dbgmsg("cli_pdf: calculated length %" PRId64 " < %" | ||
347 | + _ssizet "\n", | ||
348 | length, size); | ||
349 | length = size; | ||
350 | } | ||
351 | } | ||
352 | |||
353 | if (orig_length && size > (size_t)orig_length + 20) { | ||
354 | - cli_dbgmsg("cli_pdf: orig length: %ld, length: %ld, size: %ld\n", orig_length, length, size); | ||
355 | + cli_dbgmsg("cli_pdf: orig length: %" PRId64 ", length: %" | ||
356 | + PRId64", size: %" _ssizet "\n", orig_length, | ||
357 | + length, size); | ||
358 | pdfobj_flag(pdf, obj, BAD_STREAMLEN); | ||
359 | } | ||
360 | |||
361 | @@ -1240,7 +1247,7 @@ int pdf_extract_obj(struct pdf_struct *pdf, struct pdf_obj *obj, uint32_t flags) | ||
362 | } | ||
363 | } while (0); | ||
364 | |||
365 | - cli_dbgmsg("cli_pdf: extracted %ld bytes %u %u obj to %s\n", sum, obj->id>>8, obj->id&0xff, fullname); | ||
366 | + cli_dbgmsg("cli_pdf: extracted %" PRId64 " bytes %u %u obj to %p\n", sum, obj->id>>8, obj->id&0xff, fullname); | ||
367 | |||
368 | if (flags & PDF_EXTRACT_OBJ_SCAN && sum) { | ||
369 | int rc2; | ||
370 | @@ -2493,7 +2500,8 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset) | ||
371 | |||
372 | if (pdfver != start || offset) { | ||
373 | pdf.flags |= 1 << BAD_PDF_HEADERPOS; | ||
374 | - cli_dbgmsg("cli_pdf: PDF header is not at position 0: %ld\n",pdfver-start+offset); | ||
375 | + cli_dbgmsg("cli_pdf: PDF header is not at position 0: %" PRId64 "\n", | ||
376 | + pdfver - start + offset); | ||
377 | #if HAVE_JSON | ||
378 | if (pdfobj) | ||
379 | cli_jsonbool(pdfobj, "BadVersionLocation", 1); | ||
380 | @@ -2602,7 +2610,8 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset) | ||
381 | while ((rc = pdf_findobj(&pdf)) > 0) { | ||
382 | struct pdf_obj *obj = &pdf.objs[pdf.nobjs-1]; | ||
383 | |||
384 | - cli_dbgmsg("cli_pdf: found %d %d obj @%ld\n", obj->id >> 8, obj->id&0xff, obj->start + offset); | ||
385 | + cli_dbgmsg("cli_pdf: found %d %d obj @%" PRId64 "\n", obj->id >> 8, | ||
386 | + obj->id & 0xff, obj->start + offset); | ||
387 | } | ||
388 | |||
389 | if (pdf.nobjs) | ||
390 | diff --git a/libclamav/regex_list.c b/libclamav/regex_list.c | ||
391 | index f30cc4cd4349..4b27c2974fb6 100644 | ||
392 | --- a/libclamav/regex_list.c | ||
393 | +++ b/libclamav/regex_list.c | ||
394 | @@ -41,6 +41,7 @@ | ||
395 | #include <assert.h> | ||
396 | |||
397 | #include "regex/regex.h" | ||
398 | +#include "shared/misc.h" | ||
399 | |||
400 | #include "clamav.h" | ||
401 | #include "others.h" | ||
402 | @@ -84,7 +85,9 @@ static inline size_t get_char_at_pos_with_skip(const struct pre_fixup_info* info | ||
403 | return (pos <= strlen(buffer)) ? buffer[pos>0 ? pos-1:0] : '\0'; | ||
404 | } | ||
405 | str = info->pre_displayLink.data; | ||
406 | - cli_dbgmsg("calc_pos_with_skip: skip:%lu, %lu - %lu \"%s\",\"%s\"\n", pos, info->host_start, info->host_end, str, buffer); | ||
407 | + cli_dbgmsg("calc_pos_with_skip: skip: %" _sizet ", %" _sizet " - %" | ||
408 | + _sizet " \"%s\",\"%s\"\n", pos, info->host_start, | ||
409 | + info->host_end, str, buffer); | ||
410 | pos += info->host_start; | ||
411 | while(str[realpos] && !isalnum(str[realpos])) realpos++; | ||
412 | for(; str[realpos] && (pos>0); pos--) { | ||
413 | diff --git a/libclamav/scanners.c b/libclamav/scanners.c | ||
414 | index 07a38eedc7a5..49cd70a18d9e 100644 | ||
415 | --- a/libclamav/scanners.c | ||
416 | +++ b/libclamav/scanners.c | ||
417 | @@ -49,6 +49,7 @@ | ||
418 | #define DCONF_MAIL ctx->dconf->mail | ||
419 | #define DCONF_OTHER ctx->dconf->other | ||
420 | |||
421 | +#include "shared/misc.h" | ||
422 | #include "clamav.h" | ||
423 | #include "others.h" | ||
424 | #include "dconf.h" | ||
425 | @@ -3171,8 +3172,8 @@ int cli_map_scandesc(cl_fmap_t *map, off_t offset, size_t length, cli_ctx *ctx, | ||
426 | |||
427 | if (!length) length = old_len - offset; | ||
428 | if (length > old_len - offset) { | ||
429 | - cli_dbgmsg("Data truncated: %lu -> %lu\n", | ||
430 | - (unsigned long)length, old_len - offset); | ||
431 | + cli_dbgmsg("Data truncated: %" _sizet" -> %" PRIu64" \n", length, | ||
432 | + old_len - offset); | ||
433 | length = old_len - offset; | ||
434 | } | ||
435 | |||
436 | diff --git a/shared/misc.h b/shared/misc.h | ||
437 | index 3e093936caa1..65f8c9ce0382 100644 | ||
438 | --- a/shared/misc.h | ||
439 | +++ b/shared/misc.h | ||
440 | @@ -51,6 +51,10 @@ | ||
441 | #define PATH_MAX 1024 | ||
442 | #endif | ||
443 | |||
444 | +#include <inttypes.h> | ||
445 | +#define _sizet "zu" | ||
446 | +#define _ssizet "zd" | ||
447 | + | ||
448 | char *freshdbdir(void); | ||
449 | void print_version(const char *dbdir); | ||
450 | int check_flevel(void); | ||
451 | diff --git a/shared/output.c b/shared/output.c | ||
452 | index 5e947a57a6f9..ab054a8bbeee 100644 | ||
453 | --- a/shared/output.c | ||
454 | +++ b/shared/output.c | ||
455 | @@ -214,7 +214,8 @@ static int rename_logg(STATBUF *sb) | ||
456 | |||
457 | if (!logg_rotate) { | ||
458 | if (logg_fp) { | ||
459 | - fprintf(logg_fp, "Log size = %zu, max = %zu\n", sb->st_size, logg_size); | ||
460 | + fprintf(logg_fp, "Log size = %" PRId64 ", max = %" PRId64 "\n", | ||
461 | + sb->st_size, logg_size); | ||
462 | fprintf(logg_fp, "WARNING: Log size limit met but log file rotation turned off. Forcing log file rotation anyways.\n"); | ||
463 | } | ||
464 | |||
465 | diff --git a/sigtool/sigtool.c b/sigtool/sigtool.c | ||
466 | index f2135c210e02..d67e662cfea1 100644 | ||
467 | --- a/sigtool/sigtool.c | ||
468 | +++ b/sigtool/sigtool.c | ||
469 | @@ -373,7 +373,8 @@ static char *getdsig(const char *host, const char *user, const unsigned char *da | ||
470 | closesocket(sockd); | ||
471 | return NULL; | ||
472 | } else { | ||
473 | - mprintf("Signature received (length = %lu)\n", (unsigned long)strlen(buff) - 10); | ||
474 | + mprintf("Signature received (length = %" _sizet ")\n", | ||
475 | + (unsigned long)strlen(buff) - 10); | ||
476 | } | ||
477 | } else { | ||
478 | mprintf("!getdsig: Communication error with remote server\n"); | ||