Browse code

libclamav: fix some limit settings (bb#1973)

Tomasz Kojm authored on 2010/04/27 23:35:38
Showing 5 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Apr 27 16:34:38 CEST 2010 (tk)
2
+----------------------------------
3
+ * libclamav: fix some limit settings (bb#1973)
4
+
1 5
 Mon Apr 26 18:18:47 EEST 2010 (edwin)
2 6
 -------------------------------------
3 7
  * bytecode: min/max functionality level support.
... ...
@@ -408,7 +408,7 @@ Files larger than this limit won't be scanned. Affects the input file itself as
408 408
 Default: 25M
409 409
 .TP 
410 410
 \fBMaxRecursion NUMBER\fR
411
-Nested archives are scanned recursively, e.g. if a Zip archive contains a RAR file, all files within it will also be scanned. This options specifies how deeply the process should be continued. \fBWarning: disabling this limit or setting it too high may result in severe damage to the system.\fR
411
+Nested archives are scanned recursively, e.g. if a Zip archive contains a RAR file, all files within it will also be scanned. This options specifies how deeply the process should be continued. \fBWarning: setting this limit too high may result in severe damage to the system.\fR
412 412
 .br 
413 413
 Default: 16
414 414
 .TP 
... ...
@@ -398,9 +398,7 @@ Example
398 398
 # Nested archives are scanned recursively, e.g. if a Zip archive contains a RAR
399 399
 # file, all files within it will also be scanned. This options specifies how
400 400
 # deeply the process should be continued.
401
-# Note: disabling this limit or setting it too high may result in severe damage
402
-# to the system.
403
-# Value of 0 disables the limit.
401
+# Note: setting this limit too high may result in severe damage to the system.
404 402
 # Default: 16
405 403
 #MaxRecursion 10
406 404
 
... ...
@@ -355,7 +355,11 @@ int cl_engine_set_num(struct cl_engine *engine, enum cl_engine_field field, long
355 355
 	    engine->maxfilesize = num;
356 356
 	    break;
357 357
 	case CL_ENGINE_MAX_RECURSION:
358
-	    engine->maxreclevel = num;
358
+	    if(!num) {
359
+		cli_warnmsg("MaxRecursion: the value of 0 is not allowed, using default: %u\n", CLI_DEFAULT_MAXRECLEVEL);
360
+		engine->maxreclevel = CLI_DEFAULT_MAXRECLEVEL;
361
+	    } else
362
+		engine->maxreclevel = num;
359 363
 	    break;
360 364
 	case CL_ENGINE_MAX_FILES:
361 365
 	    engine->maxfiles = num;
... ...
@@ -733,7 +733,7 @@ static int cli_scanmscab(int desc, cli_ctx *ctx, off_t sfx_offset)
733 733
 	if(ctx->engine->maxscansize && ctx->scansize + ctx->engine->maxfilesize >= ctx->engine->maxscansize)
734 734
 	    file->max_size = ctx->engine->maxscansize - ctx->scansize;
735 735
 	else
736
-	    file->max_size = ctx->engine->maxfilesize;
736
+	    file->max_size = ctx->engine->maxfilesize ? ctx->engine->maxfilesize : 0xffffffff;
737 737
 
738 738
 	cli_dbgmsg("CAB: Extracting file %s to %s, size %u, max_size: %u\n", file->name, tempname, file->length, (unsigned int) file->max_size);
739 739
 	file->written_size = 0;