From 294d07746977968175c2b191780be00d9fa7a4a8 Mon Sep 17 00:00:00 2001 From: Nigel Horne Date: Tue, 4 Nov 2003 08:28:47 +0000 Subject: [PATCH] Handle multipart messages that have no text portion git-svn: trunk@95 --- clamav-devel/ChangeLog | 5 +++++ clamav-devel/libclamav/mbox.c | 22 ++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/clamav-devel/ChangeLog b/clamav-devel/ChangeLog index 4a01cd3a6..597f5546b 100644 --- a/clamav-devel/ChangeLog +++ b/clamav-devel/ChangeLog @@ -1,3 +1,8 @@ +Tue Nov 4 08:27:00 GMT 2003 (njh) +---------------------------------- + * libclamav: Handle multipart messages that have no text portion + (Fix by NJH, Bug notified by Laurent Wacrenier ) + Tue Nov 4 00:37:03 CET 2003 (tk) --------------------------------- * clamd: fixed signature counter (thanks to Dirk Kraemer) diff --git a/clamav-devel/libclamav/mbox.c b/clamav-devel/libclamav/mbox.c index 41372e343..2b83ba249 100644 --- a/clamav-devel/libclamav/mbox.c +++ b/clamav-devel/libclamav/mbox.c @@ -17,6 +17,9 @@ * * Change History: * $Log: mbox.c,v $ + * Revision 1.16 2003/11/04 08:24:00 nigelhorne + * Handle multipart messages that have no text portion + * * Revision 1.15 2003/10/12 20:13:49 nigelhorne * Use NO_STRTOK_R consistent with message.c * @@ -36,7 +39,7 @@ * Compilable under SCO; removed duplicate code with message.c * */ -static char const rcsid[] = "$Id: mbox.c,v 1.15 2003/10/12 20:13:49 nigelhorne Exp $"; +static char const rcsid[] = "$Id: mbox.c,v 1.16 2003/11/04 08:24:00 nigelhorne Exp $"; #ifndef CL_DEBUG /*#define NDEBUG /* map CLAMAV debug onto standard */ @@ -649,7 +652,8 @@ insert(message *mainMessage, blob **blobsIn, int nBlobs, text *textIn, const cha switch(tableFind(subtypeTable, mimeSubtype)) { case RELATED: /* - * Look for the text bit + * Have a look to see if there's HTML code + * which will need scanning */ aMessage = NULL; assert(multiparts > 0); @@ -660,9 +664,9 @@ insert(message *mainMessage, blob **blobsIn, int nBlobs, text *textIn, const cha aText = textAddMessage(aText, messages[htmltextPart]); else /* - * There isn't a text bit. If there's a - * multipart bit, it'll probably be in - * there somewhere + * There isn't an HTML bit. If there's a + * multipart bit, it'll may be in there + * somewhere */ for(i = 0; i < multiparts; i++) if(messageGetMimeType(messages[i]) == MULTIPART) { @@ -671,9 +675,11 @@ insert(message *mainMessage, blob **blobsIn, int nBlobs, text *textIn, const cha break; } - assert(htmltextPart != -1); - - rc = insert(aMessage, blobs, nBlobs, aText, dir, rfc821Table, subtypeTable); + if(htmltextPart == -1) { + cli_dbgmsg("No HTML code found to be scanned"); + rc = 0; + } else + rc = insert(aMessage, blobs, nBlobs, aText, dir, rfc821Table, subtypeTable); blobArrayDestroy(blobs, nBlobs); blobs = NULL; nBlobs = 0;