libclamav: fix error reporting for BinHex files (bb#1685)

0.96
Tomasz Kojm 16 years ago
parent 8997b14725
commit ec616ce0c5
  1. 4
      ChangeLog
  2. 14
      libclamav/binhex.c
  3. 6
      libclamav/message.c

@ -1,3 +1,7 @@
Mon Jan 4 15:35:16 CET 2010 (tk)
---------------------------------
* libclamav: fix error reporting for BinHex files (bb#1685)
Wed Dec 30 00:19:21 CET 2009 (tk)
---------------------------------
* libclamav: add support for FileSize, EntryPoint and NumberOfSections in

@ -120,6 +120,7 @@ cli_binhex(const char *dir, fmap_t *map)
long bytesleft;
message *m;
fileblob *fb;
text *t_line;
size = (size_t)map->len;
@ -179,12 +180,20 @@ cli_binhex(const char *dir, fmap_t *map)
if(line)
free(line);
if(binhexBegin(m) == NULL) {
if((t_line = binhexBegin(m)) == NULL) {
messageDestroy(m);
cli_dbgmsg("No binhex line found\n");
return CL_EFORMAT;
}
while(((t_line = t_line->t_next) != NULL) && (t_line->t_line == NULL));
if(!t_line) {
messageDestroy(m);
cli_dbgmsg("No binhex data to parse\n");
return CL_EFORMAT;
}
/* similar to binhexMessage */
messageSetEncoding(m, "x-binhex");
@ -199,5 +208,6 @@ cli_binhex(const char *dir, fmap_t *map)
if(fb)
return CL_CLEAN; /* a lie - but it gets things going */
/* return CL_EIO; */ /* probably CL_EMEM, but we can't tell at this layer */
return CL_EMEM;
/* TK: CL_EMEM is too generic here and should not be reported for parsing errors */
return CL_EFORMAT;
}

@ -1212,6 +1212,12 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy
(t_line->t_line == NULL))
;
if(!t_line) {
cli_warnmsg("No binhex data to parse\n");
(*destroy)(ret);
return NULL;
}
tmp = textToBlob(t_line, NULL,
((m->numberOfEncTypes == 1) && (m->encodingTypes[0] == BINHEX)) ? destroy_text : 0);

Loading…
Cancel
Save