fixed segfault with Bagle rars

git-svn: trunk@401
remotes/push_mirror/metadata
Tomasz Kojm 22 years ago
parent fb787a061a
commit b5f8af0dc6
  1. 4
      clamav-devel/ChangeLog
  2. 6
      clamav-devel/libclamav/scanners.c
  3. 2
      clamav-devel/libclamav/unrarlib.c

@ -1,3 +1,7 @@
Mon Mar 15 17:05:01 CET 2004 (tk)
---------------------------------
* libclamav: unrarlib: fixed segfault with some Bagle's RAR archives
Sun Mar 14 21:48:25 CET 2004 (tk) Sun Mar 14 21:48:25 CET 2004 (tk)
--------------------------------- ---------------------------------
* etc/clamav.conf: ScanOLE2 enabled by default * etc/clamav.conf: ScanOLE2 enabled by default

@ -173,7 +173,7 @@ static void cli_unlock_mutex(void *mtx)
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) 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)
{ {
FILE *tmp = NULL; FILE *tmp = NULL;
int files = 0, fd, ret = CL_CLEAN; int files = 0, fd, ret = CL_CLEAN, afiles;
ArchiveList_struct *rarlist = NULL; ArchiveList_struct *rarlist = NULL;
ArchiveList_struct *rarlist_head = NULL; ArchiveList_struct *rarlist_head = NULL;
char *rar_data_ptr; char *rar_data_ptr;
@ -188,7 +188,7 @@ static int cli_scanrar(int desc, const char **virname, long int *scanned, const
cli_scanrar_inuse = 1; cli_scanrar_inuse = 1;
#endif #endif
if(!urarlib_list(desc, (ArchiveList_struct *) &rarlist)) { if(! (afiles = urarlib_list(desc, (ArchiveList_struct *) &rarlist))) {
#ifdef CL_THREAD_SAFE #ifdef CL_THREAD_SAFE
pthread_mutex_unlock(&cli_scanrar_mutex); pthread_mutex_unlock(&cli_scanrar_mutex);
cli_scanrar_inuse = 0; cli_scanrar_inuse = 0;
@ -196,6 +196,8 @@ static int cli_scanrar(int desc, const char **virname, long int *scanned, const
return CL_ERAR; return CL_ERAR;
} }
cli_dbgmsg("Rar -> Number of archived files: %d\n", afiles);
rarlist_head = rarlist; rarlist_head = rarlist;
while(rarlist) { while(rarlist) {

@ -533,11 +533,13 @@ int urarlib_list(int desc, ArchiveList_struct *list)
if ((ReadBlockResult = ReadBlock(FILE_HEAD | READSUBBLOCK)) <= 0) /* read name of the next */ if ((ReadBlockResult = ReadBlock(FILE_HEAD | READSUBBLOCK)) <= 0) /* read name of the next */
{ /* file within the RAR archive */ { /* file within the RAR archive */
cli_dbgmsg("Couldn't read next filename from archive (I/O error): %d\n", ReadBlockResult); cli_dbgmsg("Couldn't read next filename from archive (I/O error): %d\n", ReadBlockResult);
NoOfFilesInArchive = 0;
break; /* error, file not found in */ break; /* error, file not found in */
} /* archive or I/O error */ } /* archive or I/O error */
if (BlockHead.HeadType==SUB_HEAD) if (BlockHead.HeadType==SUB_HEAD)
{ {
debug_log("Sorry, sub-headers not supported."); debug_log("Sorry, sub-headers not supported.");
NoOfFilesInArchive = 0;
break; /* error => exit */ break; /* error => exit */
} }

Loading…
Cancel
Save