git-svn: trunk@2832
Nigel Horne authored on 2007/02/22 07:02:02... | ... |
@@ -429,7 +429,7 @@ int32_t _pst_build_desc_ptr (pst_file *pf, int32_t offset, int32_t depth, int32_ |
429 | 429 |
pst_item* _pst_getItem(pst_file *pf, pst_desc_ll *d_ptr); |
430 | 430 |
static void *_pst_parse_item (pst_file *pf, pst_desc_ll *d_ptr); |
431 | 431 |
static pst_num_array *_pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head); |
432 |
-int32_t _pst_process(pst_num_array *list, pst_item *item); |
|
432 |
+static int32_t _pst_process(pst_num_array *list, pst_item *item); |
|
433 | 433 |
int32_t _pst_free_list(pst_num_array *list); |
434 | 434 |
void _pst_freeItem(pst_item *item); |
435 | 435 |
int32_t _pst_free_id2(pst_index2_ll * head); |
... | ... |
@@ -814,7 +814,7 @@ static int32_t |
814 | 814 |
pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE *fp) |
815 | 815 |
{ |
816 | 816 |
pst_index_ll *ptr; |
817 |
- int32_t size; |
|
817 |
+ int32_t size = 0; |
|
818 | 818 |
char *c; |
819 | 819 |
|
820 | 820 |
if (attach->id_val != -1) { |
... | ... |
@@ -899,10 +899,10 @@ pst_load_extended_attributes(pst_file *pf) |
899 | 899 |
// for PST files this will load up ID2 0x61 and check it's "list" attribute. |
900 | 900 |
pst_desc_ll *p; |
901 | 901 |
pst_num_array *na; |
902 |
- pst_index2_ll *list2; |
|
902 |
+ pst_index2_ll *list2 = NULL; |
|
903 | 903 |
unsigned char * buffer=NULL, *headerbuffer=NULL; |
904 | 904 |
pst_x_attrib xattrib; |
905 |
- int32_t bptr = 0, bsize, hsize, tint, err=0, x; |
|
905 |
+ int32_t bptr = 0, bsize = 0, hsize, tint, err=0, x; |
|
906 | 906 |
pst_x_attrib_ll *ptr, *p_head=NULL, *p_sh=NULL, *p_sh2=NULL; |
907 | 907 |
|
908 | 908 |
if ((p = _pst_getDptr(pf, 0x61)) == NULL) { |
... | ... |
@@ -1963,8 +1963,9 @@ _pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head) |
1963 | 1963 |
cli_dbgmsg("not able to read the ID2 data. Setting to be read later. %#x\n", |
1964 | 1964 |
table_rec.value); |
1965 | 1965 |
na_ptr->items[x]->size = 0; |
1966 |
- na_ptr->items[x]->data = NULL; |
|
1967 | 1966 |
na_ptr->items[x]->type = table_rec.value; |
1967 |
+ free(na_ptr->items[x]->data); |
|
1968 |
+ na_ptr->items[x]->data = NULL; |
|
1968 | 1969 |
} |
1969 | 1970 |
cli_dbgmsg("Read %i bytes to a buffer at %p\n", |
1970 | 1971 |
na_ptr->items[x]->size, na_ptr->items[x]->data); |
... | ... |
@@ -2036,6 +2037,7 @@ _pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head) |
2036 | 2036 |
na_ptr->items[x]->type = table_rec.ref_type; |
2037 | 2037 |
} else { |
2038 | 2038 |
cli_warnmsg("ERROR Unknown ref_type %#x\n", table_rec.ref_type); |
2039 |
+ if(buf) free(buf); |
|
2039 | 2040 |
if(na_head) |
2040 | 2041 |
_pst_free_list(na_head); |
2041 | 2042 |
return NULL; |
... | ... |
@@ -2088,8 +2090,10 @@ _pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head) |
2088 | 2088 |
}\ |
2089 | 2089 |
} |
2090 | 2090 |
|
2091 |
-int32_t _pst_process(pst_num_array *list , pst_item *item) { |
|
2092 |
- int32_t x; |
|
2091 |
+static int32_t |
|
2092 |
+_pst_process(pst_num_array *list , pst_item *item) |
|
2093 |
+{ |
|
2094 |
+ int32_t x, t; |
|
2093 | 2095 |
int32_t next = 0; |
2094 | 2096 |
pst_item_attach *attach; |
2095 | 2097 |
pst_item_extra_field *ef; |
... | ... |
@@ -2585,7 +2589,9 @@ int32_t _pst_process(pst_num_array *list , pst_item *item) { |
2585 | 2585 |
cli_dbgmsg("Attachment Size - "); |
2586 | 2586 |
NULL_CHECK(attach); |
2587 | 2587 |
MOVE_NEXT(attach); |
2588 |
- memcpy(&(attach->size), list->items[x]->data, sizeof(attach->size)); |
|
2588 |
+ t = (*(int32_t *)list->items[x]->data); |
|
2589 |
+ LE32_CPU(t); |
|
2590 |
+ attach->size = t; |
|
2589 | 2591 |
cli_dbgmsg("%i\n", attach->size); |
2590 | 2592 |
//INC_CHECK_X(); |
2591 | 2593 |
break; |
... | ... |
@@ -2879,7 +2885,8 @@ int32_t _pst_process(pst_num_array *list , pst_item *item) { |
2879 | 2879 |
MOVE_NEXT(attach); |
2880 | 2880 |
memcpy(&(attach->position), list->items[x]->data, sizeof(attach->position)); |
2881 | 2881 |
LE32_CPU(attach->position); |
2882 |
- cli_dbgmsg("%i [%#x]\n", attach->position); |
|
2882 |
+ /*cli_dbgmsg("%i [%#x]\n", attach->position);*/ |
|
2883 |
+ cli_dbgmsg("[%#x]\n", attach->position); |
|
2883 | 2884 |
//INC_CHECK_X(); |
2884 | 2885 |
break; |
2885 | 2886 |
case 0x3707: // PR_ATTACH_LONG_FILENAME Attachment filename (long?) |
... | ... |
@@ -3750,10 +3757,10 @@ int32_t _pst_free_list(pst_num_array *list) { |
3750 | 3750 |
pst_num_array *l; |
3751 | 3751 |
while (list != NULL) { |
3752 | 3752 |
while (x < list->count_item) { |
3753 |
- if (list->items[x]->data != NULL) { |
|
3754 |
- free (list->items[x]->data); |
|
3755 |
- } |
|
3756 | 3753 |
if (list->items[x] != NULL) { |
3754 |
+ if (list->items[x]->data != NULL) { |
|
3755 |
+ free (list->items[x]->data); |
|
3756 |
+ } |
|
3757 | 3757 |
free (list->items[x]); |
3758 | 3758 |
} |
3759 | 3759 |
x++; |
... | ... |
@@ -5380,7 +5387,7 @@ pst_decode(const char *dir, int desc) |
5380 | 5380 |
if ((temp = item->email->outlook_sender) == NULL) |
5381 | 5381 |
temp = (char *)""; |
5382 | 5382 |
fprintf(f->output, "From: \"%s\" <%s>\n", item->email->outlook_sender_name, temp); |
5383 |
- if (item->email->subject != NULL) { |
|
5383 |
+ if ((item->email->subject != NULL) && (item->email->subject->subj != NULL)) { |
|
5384 | 5384 |
fprintf(f->output, "Subject: %s\n", item->email->subject->subj); |
5385 | 5385 |
} /*else |
5386 | 5386 |
fprintf(f->output, "Subject: \n");*/ |