git-svn: trunk@2542
Nigel Horne authored on 2006/12/07 20:08:04... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Thu Dec 7 11:07:12 GMT 2006 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/pst.c: Incorporated upstream patches |
|
4 |
+ |
|
1 | 5 |
Thu Dec 7 09:18:58 GMT 2006 (njh) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav/message.c: Handle consecutive errors in base64 decoding |
... | ... |
@@ -59,7 +63,7 @@ Thu Nov 30 09:35:46 GMT 2006 (njh) |
59 | 59 |
Wed Nov 29 16:04:18 GMT 2006 (njh) |
60 | 60 |
---------------------------------- |
61 | 61 |
* libclamav/pst.c: Handle "all day appointment flag" patch posted to |
62 |
- the libpst mailing list |
|
62 |
+ the libpst mailing list |
|
63 | 63 |
|
64 | 64 |
Tue Nov 28 14:31:58 GMT 2006 (njh) |
65 | 65 |
---------------------------------- |
... | ... |
@@ -36,7 +36,7 @@ |
36 | 36 |
* TODO: Remove the vcard handling |
37 | 37 |
* FIXME: The code does little error checking of OOM scenarios |
38 | 38 |
*/ |
39 |
-static char const rcsid[] = "$Id: pst.c,v 1.36 2006/12/02 17:44:05 njh Exp $"; |
|
39 |
+static char const rcsid[] = "$Id: pst.c,v 1.37 2006/12/07 11:06:24 njh Exp $"; |
|
40 | 40 |
|
41 | 41 |
#if HAVE_CONFIG_H |
42 | 42 |
#include "clamav-config.h" /* must come first */ |
... | ... |
@@ -1496,6 +1496,7 @@ int32_t _pst_build_desc_ptr (pst_file *pf, int32_t offset, int32_t depth, int32_ |
1496 | 1496 |
} else { |
1497 | 1497 |
// hopefully a table of offsets to more tables |
1498 | 1498 |
if (_pst_read_block_size(pf, offset, DESC_BLOCK_SIZE, &buf, 0, 0) < DESC_BLOCK_SIZE) { |
1499 |
+ if(buf) free(buf); |
|
1499 | 1500 |
cli_dbgmsg("didn't read enough desc index. _pst_read_block_size returned less than requested\n"); |
1500 | 1501 |
return -1; |
1501 | 1502 |
} |
... | ... |
@@ -1578,11 +1579,13 @@ _pst_parse_item(pst_file *pf, pst_desc_ll *d_ptr) |
1578 | 1578 |
} |
1579 | 1579 |
|
1580 | 1580 |
if (d_ptr->desc == NULL) { |
1581 |
+ if(id2_head) _pst_free_id2(id2_head); |
|
1581 | 1582 |
cli_errmsg("why is d_ptr->desc == NULL? I don't want to do anything else with this record\n"); |
1582 | 1583 |
return NULL; |
1583 | 1584 |
} |
1584 | 1585 |
|
1585 | 1586 |
if((list = _pst_parse_block(pf, d_ptr->desc->id, id2_head)) == NULL) { |
1587 |
+ if(id2_head) _pst_free_id2(id2_head); |
|
1586 | 1588 |
cli_errmsg("_pst_parse_block() returned an error for d_ptr->desc->id [%#x]\n", d_ptr->desc->id); |
1587 | 1589 |
return NULL; |
1588 | 1590 |
} |
... | ... |
@@ -1590,6 +1593,9 @@ _pst_parse_item(pst_file *pf, pst_desc_ll *d_ptr) |
1590 | 1590 |
item = (pst_item*) cli_calloc(1, sizeof(pst_item)); |
1591 | 1591 |
|
1592 | 1592 |
if (_pst_process(list, item)) { |
1593 |
+ if(item) free(item); |
|
1594 |
+ if(list) _pst_free_list(list); |
|
1595 |
+ if(id2_head) _pst_free_id2(id2_head); |
|
1593 | 1596 |
cli_dbgmsg("_pst_process() returned non-zero value. That is an error\n"); |
1594 | 1597 |
_pst_free_list(list); |
1595 | 1598 |
return NULL; |
... | ... |
@@ -1608,7 +1614,8 @@ _pst_parse_item(pst_file *pf, pst_desc_ll *d_ptr) |
1608 | 1608 |
|
1609 | 1609 |
cli_dbgmsg("ATTACHEMENT processing attachement\n"); |
1610 | 1610 |
if ((list = _pst_parse_block(pf, id_ptr->id, id2_head)) == NULL) { |
1611 |
- _pst_free_id2(id2_head); |
|
1611 |
+ if(item) free(item); |
|
1612 |
+ if(id2_head) _pst_free_id2(id2_head); |
|
1612 | 1613 |
_pst_free_list(list); |
1613 | 1614 |
cli_errmsg("error processing main attachment record\n"); |
1614 | 1615 |
return NULL; |
... | ... |
@@ -1623,12 +1630,12 @@ _pst_parse_item(pst_file *pf, pst_desc_ll *d_ptr) |
1623 | 1623 |
item->current_attach = item->attach; |
1624 | 1624 |
|
1625 | 1625 |
if (_pst_process(list, item)) { |
1626 |
- _pst_free_list(list); |
|
1627 |
- _pst_free_id2(id2_head); |
|
1626 |
+ if( id2_head) _pst_free_id2(id2_head); |
|
1627 |
+ if(list) _pst_free_list(list); |
|
1628 | 1628 |
cli_errmsg("_pst_process() failed with attachments\n"); |
1629 | 1629 |
return NULL; |
1630 | 1630 |
} |
1631 |
- _pst_free_list(list); |
|
1631 |
+ if(list) _pst_free_list(list); |
|
1632 | 1632 |
|
1633 | 1633 |
// now we will have initial information of each attachment stored in item->attach... |
1634 | 1634 |
// we must now read the secondary record for each based on the id2 val associated with |
... | ... |
@@ -1648,10 +1655,17 @@ _pst_parse_item(pst_file *pf, pst_desc_ll *d_ptr) |
1648 | 1648 |
if (_pst_process(list, item)) { |
1649 | 1649 |
cli_dbgmsg("ERROR _pst_process() failed with an attachment\n"); |
1650 | 1650 |
_pst_free_list(list); |
1651 |
+ if(list) { |
|
1652 |
+ pst_free_list(list); |
|
1653 |
+ list = NULL; |
|
1654 |
+ } |
|
1651 | 1655 |
attach = attach->next; |
1652 | 1656 |
continue; |
1653 | 1657 |
} |
1654 |
- _pst_free_list(list); |
|
1658 |
+ if(list) { |
|
1659 |
+ pst_free_list(list); |
|
1660 |
+ list = NULL; |
|
1661 |
+ } |
|
1655 | 1662 |
if ((id_ptr = _pst_getID2(id2_head, attach->id2_val)) != NULL) { |
1656 | 1663 |
// id2_val has been updated to the ID2 value of the datablock containing the |
1657 | 1664 |
// attachment data |
... | ... |
@@ -3817,6 +3831,7 @@ _pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr) { |
3817 | 3817 |
pst_id2_assoc id2_rec; |
3818 | 3818 |
pst_index_ll *i_ptr = NULL; |
3819 | 3819 |
pst_index2_ll *i2_ptr = NULL; |
3820 |
+ |
|
3820 | 3821 |
if (head_ptr != NULL) { |
3821 | 3822 |
head = head_ptr; |
3822 | 3823 |
while (head_ptr != NULL) |
... | ... |
@@ -3824,9 +3839,9 @@ _pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr) { |
3824 | 3824 |
} |
3825 | 3825 |
if (_pst_read_block_size(pf, list->offset, list->size, &buf, PST_NO_ENC,0) < list->size) { |
3826 | 3826 |
//an error occured in block read |
3827 |
- cli_warnmsg("block read error occured. offset = %#x, size = %#x\n", list->offset, list->size); |
|
3828 | 3827 |
if(buf) |
3829 | 3828 |
free(buf); |
3829 |
+ cli_warnmsg("block read error occured. offset = %#x, size = %#x\n", list->offset, list->size); |
|
3830 | 3830 |
return NULL; |
3831 | 3831 |
} |
3832 | 3832 |
|
... | ... |
@@ -3835,9 +3850,9 @@ _pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr) { |
3835 | 3835 |
LE16_CPU(block_head.count); |
3836 | 3836 |
|
3837 | 3837 |
if (block_head.type != 0x0002) { // some sort of constant? |
3838 |
- cli_warnmsg("Unknown constant [%#x] at start of id2 values [offset %#x].\n", block_head.type, list->offset); |
|
3839 | 3838 |
if(buf) |
3840 | 3839 |
free(buf); |
3840 |
+ cli_warnmsg("Unknown constant [%#x] at start of id2 values [offset %#x].\n", block_head.type, list->offset); |
|
3841 | 3841 |
return NULL; |
3842 | 3842 |
} |
3843 | 3843 |
|