Browse code

bb#2027

aCaB authored on 2010/05/18 02:09:16
Showing 2 changed files
... ...
@@ -1,3 +1,9 @@
1
+Mon May 17 19:03:51 CEST 2010 (acab)
2
+------------------------------------
3
+ * libclamav/pe.c: properly resume stringtable loop (bb#2027)
4
+                   Note: 0.96 is NOT affected as the min VI sig has got FL=53
5
+			3rd parties must avoid VI sigs with FL=51
6
+
1 7
 Fri May 14 17:16:19 EEST 2010 (edwin)
2 8
 -------------------------------------
3 9
  * unit_tests: add bytecode.cvd load test
... ...
@@ -2522,6 +2522,8 @@ int cli_peheader(fmap_t *map, struct cli_exe_info *peinfo)
2522 2522
 
2523 2523
 		    while(sfi_sz > 6) { /* enum all stringtables - RESUMABLE */
2524 2524
 			uint32_t st_sz = cli_readint32(vptr) & 0xffff;
2525
+			uint8_t *next_vptr = vptr + st_sz;
2526
+			uint32_t next_sfi_sz = sfi_sz - st_sz;
2525 2527
 
2526 2528
 			if(st_sz > sfi_sz || st_sz <= 24) {
2527 2529
 			    /* - the content is larger than the container
... ...
@@ -2604,8 +2606,8 @@ int cli_peheader(fmap_t *map, struct cli_exe_info *peinfo)
2604 2604
 			    vptr += s_sz;
2605 2605
 			    st_sz -= s_sz;
2606 2606
 			} /* enum all strings - RESUMABLE */
2607
-			vptr += st_sz;
2608
-			sfi_sz -= st_sz;
2607
+			vptr = next_vptr;
2608
+			sfi_sz = next_sfi_sz * (sfi_sz != 0);
2609 2609
 		    } /* enum all stringtables - RESUMABLE */
2610 2610
 		    break;
2611 2611
 		} /* look for stringfileinfo - NOT RESUMABLE */