Browse code

sanity check the number of rebuilt sections

git-svn: trunk@2434

aCaB authored on 2006/10/27 09:43:22
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Oct 27 02:37:49 CEST 2006 (acab)
2
+------------------------------------
3
+  * libclamav/petite.c: sanity check the number of rebuilt sections
4
+
1 5
 Wed Oct 25 18:03:34 CEST 2006 (tk)
2 6
 ----------------------------------
3 7
   * sigtool/sigtool.c: new option --utf16-decode
... ...
@@ -280,6 +280,11 @@ int petite_inflate2x_1to9(char *buf, uint32_t minrva, uint32_t bufsz, struct pe_
280 280
       thisrva=cli_readint32(packed+8); /* RVA of the original section */
281 281
       packed += 0x10;
282 282
 
283
+      if ( j >= 90 ) {
284
+	cli_dbgmsg("Petite: maximum number of sections exceeded, giving up.\n");
285
+	free(usects);
286
+	return -1;
287
+      }
283 288
       /* Alloc 1 more struct */
284 289
       if ( ! (tmpsct = cli_realloc(usects, sizeof(struct SECTION) * (j+1))) ) {
285 290
 	if (usects)