git-svn: trunk@3068
Tomasz Kojm authored on 2007/05/28 21:15:21... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Mon May 28 13:39:55 CEST 2007 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav: revert r3054, to be replaced with session based limits |
|
4 |
+ |
|
1 | 5 |
Sat May 26 14:05:44 CEST 2007 (tk) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav/matcher-ac.c: fix segfault on OOM (bb#515) |
... | ... |
@@ -185,6 +185,17 @@ static int cli_unrar_scanmetadata(int desc, rar_metadata_t *metadata, cli_ctx *c |
185 | 185 |
static int cli_unrar_checklimits(const cli_ctx *ctx, const rar_metadata_t *metadata, unsigned int files) |
186 | 186 |
{ |
187 | 187 |
if(ctx->limits) { |
188 |
+ if(ctx->limits->maxratio && metadata->unpack_size && metadata->pack_size) { |
|
189 |
+ if(metadata->unpack_size / metadata->pack_size >= ctx->limits->maxratio) { |
|
190 |
+ cli_dbgmsg("RAR: Max ratio reached (%u, max: %u)\n", (unsigned int) (metadata->unpack_size / metadata->pack_size), ctx->limits->maxratio); |
|
191 |
+ if(BLOCKMAX) { |
|
192 |
+ *ctx->virname = "Oversized.RAR"; |
|
193 |
+ return CL_VIRUS; |
|
194 |
+ } |
|
195 |
+ return CL_EMAXSIZE; |
|
196 |
+ } |
|
197 |
+ } |
|
198 |
+ |
|
188 | 199 |
if(ctx->limits->maxfilesize && (metadata->unpack_size > ctx->limits->maxfilesize)) { |
189 | 200 |
cli_dbgmsg("RAR: %s: Size exceeded (%lu, max: %lu)\n", metadata->filename, (unsigned long int) metadata->unpack_size, ctx->limits->maxfilesize); |
190 | 201 |
if(BLOCKMAX) { |
... | ... |
@@ -194,21 +205,6 @@ static int cli_unrar_checklimits(const cli_ctx *ctx, const rar_metadata_t *metad |
194 | 194 |
return CL_EMAXSIZE; |
195 | 195 |
} |
196 | 196 |
|
197 |
- if(ctx->limits->maxratio && metadata->unpack_size && metadata->pack_size) { |
|
198 |
- if(metadata->unpack_size / metadata->pack_size >= ctx->limits->maxratio) { |
|
199 |
- cli_dbgmsg("RAR: Max ratio reached (%u, max: %u)\n", (unsigned int) (metadata->unpack_size / metadata->pack_size), ctx->limits->maxratio); |
|
200 |
- if(ctx->limits->maxfilesize && (metadata->unpack_size <= ctx->limits->maxfilesize)) { |
|
201 |
- cli_dbgmsg("RAR: Ignoring ratio limit (file size doesn't hit limits)\n"); |
|
202 |
- } else { |
|
203 |
- if(BLOCKMAX) { |
|
204 |
- *ctx->virname = "Oversized.RAR"; |
|
205 |
- return CL_VIRUS; |
|
206 |
- } |
|
207 |
- return CL_EMAXSIZE; |
|
208 |
- } |
|
209 |
- } |
|
210 |
- } |
|
211 |
- |
|
212 | 197 |
if(ctx->limits->maxfiles && (files > ctx->limits->maxfiles)) { |
213 | 198 |
cli_dbgmsg("RAR: Files limit reached (max: %u)\n", ctx->limits->maxfiles); |
214 | 199 |
if(BLOCKMAX) { |
... | ... |
@@ -440,13 +436,9 @@ static int cli_scanzip(int desc, cli_ctx *ctx, off_t sfx_offset, uint32_t *sfx_c |
440 | 440 |
} |
441 | 441 |
|
442 | 442 |
if(ctx->limits && ctx->limits->maxratio > 0 && ((unsigned) zdirent.st_size / (unsigned) zdirent.d_csize) >= ctx->limits->maxratio) { |
443 |
- if(ctx->limits->maxfilesize && ((unsigned int) zdirent.st_size <= ctx->limits->maxfilesize)) { |
|
444 |
- cli_dbgmsg("Zip: Ignoring ratio limit (file size doesn't hit limits)\n"); |
|
445 |
- } else { |
|
446 |
- *ctx->virname = "Oversized.Zip"; |
|
447 |
- ret = CL_VIRUS; |
|
448 |
- break; |
|
449 |
- } |
|
443 |
+ *ctx->virname = "Oversized.Zip"; |
|
444 |
+ ret = CL_VIRUS; |
|
445 |
+ break; |
|
450 | 446 |
} |
451 | 447 |
|
452 | 448 |
if(DETECT_ENCRYPTED && encrypted) { |