Don't copy if the decoded == the encoded

git-svn: trunk@948
remotes/push_mirror/metadata
Nigel Horne 21 years ago
parent c77c880900
commit ab4038b42d
  1. 4
      clamav-devel/ChangeLog
  2. 20
      clamav-devel/libclamav/message.c

@ -1,3 +1,7 @@
Tue Sep 28 19:41:39 BST 2004 (njh)
----------------------------------
* libclamav: Some small speed and size optimisations in MIME decoding
Tue Sep 28 15:46:18 BST 2004 (njh)
---------------------------------
* contrib/clamavmon: No longer multithreaded

@ -17,6 +17,9 @@
*
* Change History:
* $Log: message.c,v $
* Revision 1.91 2004/09/28 18:39:48 nigelhorne
* Don't copy if the decoded == the encoded
*
* Revision 1.90 2004/09/22 16:24:22 nigelhorne
* Fix error return
*
@ -267,7 +270,7 @@
* uuencodebegin() no longer static
*
*/
static char const rcsid[] = "$Id: message.c,v 1.90 2004/09/22 16:24:22 nigelhorne Exp $";
static char const rcsid[] = "$Id: message.c,v 1.91 2004/09/28 18:39:48 nigelhorne Exp $";
#if HAVE_CONFIG_H
#include "clamav-config.h"
@ -1703,7 +1706,20 @@ messageToText(message *m)
if(last == NULL)
break;
last->t_line = ((data[0] != '\n') && data[0]) ? lineCreate((char *)data) : NULL;
/*
* If the decoded line is the same as the encoded
* there's no need to take a copy, just link it.
* Note that the comparison is done without the
* trailing newline that the decoding routine may have
* added - that's why there's a strncmp rather than a
* strcmp - that'd be bad for MIME decoders, but is OK
* for AV software
*/
if(line && (strncmp(data, line, strlen(line)) == 0)) {
cli_dbgmsg("messageToText: decoded line is the same(%s)\n", data);
last->t_line = lineLink(t_line->t_line);
} else
last->t_line = ((data[0] != '\n') && data[0]) ? lineCreate((char *)data) : NULL;
if(line && enctype == BASE64)
if(strchr(line, '='))

Loading…
Cancel
Save