Fix crash in base64 encoded binhex files

git-svn: trunk@1118
remotes/push_mirror/metadata
Nigel Horne 21 years ago
parent b116962d57
commit 1509feeae3
  1. 5
      clamav-devel/ChangeLog
  2. 20
      clamav-devel/libclamav/binhex.c

@ -1,3 +1,8 @@
Tue Nov 23 09:06:45 GMT 2004 (njh)
----------------------------------
* libclamav/binhex.c: Fix crash in base64 encoded binhex files reported by
Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>
Mon Nov 22 15:20:07 GMT 2004 (njh)
----------------------------------
* libclamav: General performance enhancements

@ -17,6 +17,9 @@
*
* Change History:
* $Log: binhex.c,v $
* Revision 1.7 2004/11/23 09:05:26 nigelhorne
* Fix crash in base64 encoded binhex files
*
* Revision 1.6 2004/11/22 15:16:53 nigelhorne
* Use cli_realloc instead of many cli_mallocs
*
@ -33,7 +36,7 @@
* First draft of binhex.c
*
*/
static char const rcsid[] = "$Id: binhex.c,v 1.6 2004/11/22 15:16:53 nigelhorne Exp $";
static char const rcsid[] = "$Id: binhex.c,v 1.7 2004/11/23 09:05:26 nigelhorne Exp $";
#include "clamav.h"
@ -75,7 +78,8 @@ cli_binhex(const char *dir, int desc)
{
struct stat statb;
char *buf, *start, *line;
size_t size, bytesleft;
size_t size;
int bytesleft;
message *m;
fileblob *fb;
@ -97,28 +101,28 @@ cli_binhex(const char *dir, int desc)
cli_dbgmsg("mmap'ed binhex file\n");
bytesleft = size;
bytesleft = (int)size;
line = NULL;
while(bytesleft) {
while(bytesleft > 0) {
int length = 0;
char *ptr;
/* printf("%d: ", bytesleft); */
/*printf("%d: ", bytesleft);*/
for(ptr = buf; bytesleft && (*ptr != '\r') && (*ptr != '\n'); ptr++) {
for(ptr = buf; bytesleft && *ptr && (*ptr != '\r') && (*ptr != '\n'); ptr++) {
length++;
--bytesleft;
}
/* printf("%d: ", length); */
/*printf("%d: ", length);*/
line = cli_realloc(line, length + 1);
memcpy(line, buf, length);
line[length] = '\0';
/* puts(line); */
/*puts(line);*/
if(messageAddStr(m, line) < 0)
break;

Loading…
Cancel
Save