git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@401 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2004/03/16 01:01:55... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Mon Mar 15 17:05:01 CET 2004 (tk) |
|
2 |
+--------------------------------- |
|
3 |
+ * libclamav: unrarlib: fixed segfault with some Bagle's RAR archives |
|
4 |
+ |
|
1 | 5 |
Sun Mar 14 21:48:25 CET 2004 (tk) |
2 | 6 |
--------------------------------- |
3 | 7 |
* etc/clamav.conf: ScanOLE2 enabled by default |
... | ... |
@@ -173,7 +173,7 @@ static void cli_unlock_mutex(void *mtx) |
173 | 173 |
static int cli_scanrar(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev) |
174 | 174 |
{ |
175 | 175 |
FILE *tmp = NULL; |
176 |
- int files = 0, fd, ret = CL_CLEAN; |
|
176 |
+ int files = 0, fd, ret = CL_CLEAN, afiles; |
|
177 | 177 |
ArchiveList_struct *rarlist = NULL; |
178 | 178 |
ArchiveList_struct *rarlist_head = NULL; |
179 | 179 |
char *rar_data_ptr; |
... | ... |
@@ -188,7 +188,7 @@ static int cli_scanrar(int desc, const char **virname, long int *scanned, const |
188 | 188 |
cli_scanrar_inuse = 1; |
189 | 189 |
#endif |
190 | 190 |
|
191 |
- if(!urarlib_list(desc, (ArchiveList_struct *) &rarlist)) { |
|
191 |
+ if(! (afiles = urarlib_list(desc, (ArchiveList_struct *) &rarlist))) { |
|
192 | 192 |
#ifdef CL_THREAD_SAFE |
193 | 193 |
pthread_mutex_unlock(&cli_scanrar_mutex); |
194 | 194 |
cli_scanrar_inuse = 0; |
... | ... |
@@ -196,6 +196,8 @@ static int cli_scanrar(int desc, const char **virname, long int *scanned, const |
196 | 196 |
return CL_ERAR; |
197 | 197 |
} |
198 | 198 |
|
199 |
+ cli_dbgmsg("Rar -> Number of archived files: %d\n", afiles); |
|
200 |
+ |
|
199 | 201 |
rarlist_head = rarlist; |
200 | 202 |
|
201 | 203 |
while(rarlist) { |
... | ... |
@@ -533,11 +533,13 @@ int urarlib_list(int desc, ArchiveList_struct *list) |
533 | 533 |
if ((ReadBlockResult = ReadBlock(FILE_HEAD | READSUBBLOCK)) <= 0) /* read name of the next */ |
534 | 534 |
{ /* file within the RAR archive */ |
535 | 535 |
cli_dbgmsg("Couldn't read next filename from archive (I/O error): %d\n", ReadBlockResult); |
536 |
+ NoOfFilesInArchive = 0; |
|
536 | 537 |
break; /* error, file not found in */ |
537 | 538 |
} /* archive or I/O error */ |
538 | 539 |
if (BlockHead.HeadType==SUB_HEAD) |
539 | 540 |
{ |
540 | 541 |
debug_log("Sorry, sub-headers not supported."); |
542 |
+ NoOfFilesInArchive = 0; |
|
541 | 543 |
break; /* error => exit */ |
542 | 544 |
} |
543 | 545 |
|